Archive for the ‘ActionScript’ Category

Flash Builder 4 beta Released

We had been waiting in eager anticipation through the first half of this year for it to finally arrive. All indications were that we would be well adjusted to our new work flow by the time summer rolled around for sure, enjoying all the new tooling and features of Flex 4, round tripping some super-duper new skins with our design team via Catalyst, and improving our productivity on the whole. But as winter gave way to spring, our excitement began to wane until I had all but forgotten about the coming of this new generation of Flex. When suddenly, with almost no warning whatsoever, it was upon us… the new Flash Builder 4 beta, code named ‘Gumbo’.

Read more »

Warning: Filter will not render. are too large to be draw

If you are looking at this error in your flex compiler, make sure that the DisplayObject that you are trying to add to the stage is subclassing UIComponent and not UIMovieClip. The two are nearly interchangeable, yet the UIMovieClip needs specific bounds.

Happy Coding!

Full Browser Flash with changing background color and automatic scrollbars

Bowen and Company website, design by Florio Design

Bowen and Company website, design by Florio Design

I finished a Flash animation for a client in which the background color of the movie fades from brown to white. The client liked it but decided that he would like the background of the browser (behind the embedded Flash movie) to change as well.

I figured the best solution would be to make the Flash movie full browser. So here is the solution that I came up with:

Read more »

Using the Factory Method Pattern

 Introduction to a Classic OOP Design Pattern

Throughout my career as a developer I have had the occasion to use the Factory Method Pattern when appropriate, and grown to rely on it extensively in recent months as several projects have dictated. I find this pattern to be extremely useful in creating a loosely-coupled application architecture, which (as we’ve all been indoctrinated) is the cornerstone of well designed apps. It is my hope that this introduction will illuminate this pattern for the uninitiated. Even if you don’t find an immediate application for the Factory Pattern, just understanding the ‘why’ and ‘how’ of this design can be important in grasping the importance of the “open-closed” principle, and will help you to write better code. 

Let me start off by giving the standard text-book definition of the pattern:

The Factory Pattern “…define[s] an interface for creating an object, but allows the subclasses decide which class to instantiate. The Factory method lets a class defer instantiation to subclasses.” 

Read more »

AS3 Tutorial – The Singleton Pattern

One of the most important patterns that we use over here is the Singleton. It’s used when you need to restrict use of a class to one or only one instance. This comes in handy when you are casting things like application wide settings, or if you are building something like a logging service. There is a bit of disagreement on the use of the singleton, but it really boils down to two questions:

  • Will you use this class exactly the same way?
  • Will you only ever need only one instance of this class?

If you answer yes to these two questions, you might have the case to build a singleton. – So here is how you go about doing it in AS3 -it’s a bit tricksy ’cause as3 has no private constructors:

Read more »

Pass an Event from .AS file to Flash Movie

An important part of being able to quickly create small Flash applications, is to be able to combine the use of custom classes (.as files), and code that is embedded in the Flash timeline through the use of custom events.  Read more »

Embedding Assets in Flex

Just working on another fun project here, and I thought that I would share something that I don’t see alot of Flex developers doing out there. That is organizing your image assests into asset classes as constants. It’s an easy way to keep everything organized, and reduce your overhead, because you can creatre classes that encapsulate a skin or graphics set for a particular task. If you want to learn how read on… Read more »

AS3 Remoting ArrayCollection Tutorial – Part I

Okay, we’ve all used the <mx:RemoteObject> tag before, but now that we are following some good design principles and using a model view controller setup, we want to get rid of that tag and put the remote object logic into it’s own class.

When you decide to go ahead and start creating your own remote object classes in AS3, your’re going to have to keep in mind not only good design principles, but also encapsulation. This post is going to show you how to create an AS3 class that encapsulates the logic for connecting to a server side data service (In this one I am going to use ColdFusion, but you can easily substitute your own Ruby or Php based service). We are going to assume that you have a good understanding of Object Oriented AS3, as well as the AS3 event model.

Read more »

ActionScript Tutorial – Encapsulation, Get and Set

Ready to take the plunge into the wild world of oo ? Then here’s a quick tutorial that will get you started on one of the most important concepts behind oo -encapsulation. In this post I will explain what the concept of encapsulation is, how to use it to make your code easier to manage, more resistant to errors, and best of all, more reusable.

Read more »

ActionScript Custom Event Tutorial Part II

This post refers to AS3 Custom Event Tutorial

K, so you’re now extending the event object, having all sorts of fun, bouncing events all up and down your object tree like the destructive monkey that you are. But the question remains: How are you going to capture the events that you are dispatching? The simple answer: the event listener…which may be the most common construct in AS3. The event lister take the following form, where the eventHandler is the function we want to handle the event:

someObject.addEventListener(eventType,eventHandler);

private function eventHandler(event:eventClass):void{

//do something fun here;

}

Read more »

Next Page »