Sunday 17 February 2008

The Stage Object in a Flash CS3 Movie

the stage is treated as an Object in AS3. Here a small collection of articles on the oddities and possibilities of working with the stage object in AS3.
The first article shows the different ways of referencing the stage and it's children.

Basically here the short list of queries to have some information of the stage and it's children:

trace("Number of children of the Stage: ");
trace(stage.numChildren);

trace("What are children of Stage: ");
trace(stage.getChildAt(0));

trace("What does the keyword this refer to? ");
trace(this);

trace("Number of children of MainTimeline: ");
trace(this.numChildren);

trace("Are this.stage and stage the same? ");
trace(this.stage == stage);

trace("How many children does this.stage have? ");
trace(this.stage.numChildren);

trace("What are the children of this.stage? ");
trace(this.stage.getChild(0));


http://www.flashandmath.com/intermediate/children/stage.html

the good collection of senocular classes includes a custom stageDetection class:

http://www.senocular.com/flash/actionscript.php?file=ActionScript_3.0/com/senocular/events/StageDetection.as

No comments: