If you're doing that in a Flex app during its startup phase, there is no
stage until after applicationComplete is dispatched.  It is an evil
trick we do to optimize startup time where the application and all of
its children are not on the stage until the children are measured and
layed out.

 

IUIComponents have a systemManager property that has a valid stage
during startup and afterwards.

 

-Alex

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of {reduxdj}
Sent: Wednesday, March 07, 2007 8:17 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] simple stageHeight question

 

I've been having issues with trying to get stageHeight from sprites. 

var _sprite:Sprite = new Sprite();
addChild(_sprite)
trace (_sprite.stage.stageHeight)

give me null object reference... after it's been added to the display.

And also why can't I just access it from any class that extends Sprite 
like this:

this.stage.stageHeight or like super.stage.stageHeight;

What's confusing is I am doing this with no problem in another place. I 
just want every
sprite i make to be able to access this property. I guess I'm left 
creating a global variable.

What's the trick with this?

THanks,
patrick

 

Reply via email to