Accessing the stage in Gaia Framework
Posted: June 14th, 2009 | Author: Liza | Filed under: As3, Flash, Uncategorized, cs3, cs4 | Tags: accessing stage, flash cs4, gaia framework, resizing stage | No Comments »I have had alot of trouble trying to access the stage from Gaia Framework, but thanks to David, I’m finally getting the hang of it.
I needed to access the stage width (when resized) to create a a bar to sit behind the navigation on my site.
First I had to add this to the class constructor:
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
Then create the following 2 functions:
private function onAddedToStage(event:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
stage.addEventListener(Event.RESIZE, onResize);
onResize();
}private function onResize(event:Event = null):void
{
navBackBar.width = stage.stageWidth;
navBackBar.x = 0 - ((stage.stageWidth - Gaia.api.getWidth()) / 2);
}
navBackBar is the name of the movieclip on the stage. You can see it behind the navigation on my site.