how to
How to properly setup Sprites in
Adobe flash CS4 using ActionScript 3.0.
A very basic description for correctly setting up a Sprite.
March 29, 2012

The Sprites from within flash CS4 need to be properly defined to avoid odd effects which can make it difficult to use them from within the scripts. That is, unpredictable effects can develop if the objects (Sprites) aren't properly defined.

Here is an example of how to set up an object. The name for this example object will be an item called Space_Craft..


After creating an object on the canvas, it needs to be converted to a symbol. This can be done by right-clicking on the object, then selecting convert to symbol.

...then from within the library set the properties for the symbol:

check mark   Export for Actionscript
check mark   Export in frame 5

(your Export in frame 5 may vary depending on how your preloader is setup)

Class:     Space_Craft
Base class:     flash.display.Sprite

>>>> hitting "OK" causes Space_Craft's blue icon in the library to turn green.


Then in the action script:

public var space_craft:Space_Craft;    // a stage item


       space_craft = new Space_Craft( );



In the code above "Root.main.game_crontrol.hud_depth" is simply a specific assignment within a specific flash program, it will vary in your application. The important thing to notice is the call to: addChild(space_craft). This will properly place the new object: space_craft on the stage.

With the above steps accomplished, the components of the object "space_craft" will not vanish sporadically.

dark maelstrom icon dark maelstrom
flash games
  t-shirt icon dark maelstrom
t-shirt designs