Category Archives: Snippets

How to Send Custom Events

      No Comments on How to Send Custom Events

You can dispatch an event from any class that extends EventDispatcher. That includes Sprite and Movieclip classes. First of all create a custom event class:

How To Open an URL in AS3

      No Comments on How To Open an URL in AS3

Here is a little snippet shat shows how to open an url in a new window from as3. If you want to open the link in the same window, simply replace “_blank” parameter with “”;

How to add tint effect to a MovieClip

      No Comments on How to add tint effect to a MovieClip

Here is a simple function which adds a tint effect to a Sprite or MovieClip:

How to Compute the Real Frame Rate in enterFrame handler

In an actionscript application we can set the frame rate in main class. We can do the same in flash applications. However the number we set is not necessarily what we really get. Depending on the number of computations that should be done at each frame, the ENTER_FRAME event can… Read more »

How To Create A Rectangle Sprite in AS3

      No Comments on How To Create A Rectangle Sprite in AS3

When you create AS3 projects in flex builder or other programs you’ll need simple shapes and sprites on the fly. Here is a simple method to create them:

How to Remove an Item from an Array in AS3

      No Comments on How to Remove an Item from an Array in AS3

The Array class in actionscript 3 don’t provide a method to remove a specified object. ┬áTo achieve it we have to search and get the index of the object in the array using indexOf method and to remove it using splice method: