Hmm... sorry newbie here. So it's returning null because "this", the
_preloader, hasn't actually been instantiated yet? But if this were
called after applicationComplete then it would be fine?
Michael
Alex Harui wrote:
There is an evil nasty trick in Flex that your components aren't on
the display list until the applicationComplete event. We did that to
get a measurable performance gain at app startup. The stage is still
available, but as systemManager.stage.
-Alex
------------------------------------------------------------------------
*From:* [email protected] [mailto:[EMAIL PROTECTED]
*On Behalf Of *patricklemiuex
*Sent:* Friday, May 04, 2007 12:48 PM
*To:* [email protected]
*Subject:* [flexcoders] Acessing stage Height
I have a sprite, it's added to the display...
I understand that any display object has access to the stage Object.
Can someone clear the confusion for me, what's the deal here, I get a
null error trying to access the stage height... I've even tried to
call another method after addChild to make sure that it's already in
the display. My preloader extends sprite (of course).
This is baffling.
var _preloader = new _preloader();
addChild(_preloader);
_preloader.getHeight();
inside my preloader...
public function getHeight(){
trace (this.stage.stageHeight); //returns null object reference???
Thanks,
Patrick