hieronymous
09-30-2008, 05:58 PM
I'm using Flex Builder to code an AS3 project that does not use the flex framework. I want to position my elements dynamically based upon the stage width and height. Unfortunately I do not seem to have immediate access to stage properties. The following code shows my problem:
package
{
[SWF(width='800', height='430', backgroundColor='#000000')]
public class app extends Sprite
{
public function app():void
{
trace(stage.stageWidth); //0
}
}
}
Is there an event that gets dispatched when the stage has been created and sized? I've already tried listening for the following events.
Event.RESIZE
Event.COMPLETE
Event.INIT
Event.ADDED_TO_STAGE
FlexEvent.CREATION_COMPLETE
FlexEvent.APPLICATION_COMPLETE
Event.ADDED_TO_STAGE is the only one that gets dispatched, and at that point stage.stageWidth still returns 0.
package
{
[SWF(width='800', height='430', backgroundColor='#000000')]
public class app extends Sprite
{
public function app():void
{
trace(stage.stageWidth); //0
}
}
}
Is there an event that gets dispatched when the stage has been created and sized? I've already tried listening for the following events.
Event.RESIZE
Event.COMPLETE
Event.INIT
Event.ADDED_TO_STAGE
FlexEvent.CREATION_COMPLETE
FlexEvent.APPLICATION_COMPLETE
Event.ADDED_TO_STAGE is the only one that gets dispatched, and at that point stage.stageWidth still returns 0.