There are some funky initialization rules in AS3.0.  You cannot do
certain things in the constructor of the main class.  All of our stuff
starts up like this:
 
public class test extends MovieClip
{

public function test()
{
 super();
 root.loaderInfo.addEventListener(Event.INIT, initialize);
 
}
 
public function initialize(event:Event):void
{
// do all your real constructor work here.
...

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Patrick Lemiuex
Sent: Tuesday, May 08, 2007 8:48 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Accessing stage Height



Actually, this project is all AS3.0  no flex, so I have to access the
property through the sprites stage object.  creationComplete is out and
so is the Application object.  Hmmm. 

I am just confused.  I had to actually used a fixed stage height and
pass it into through every class constructor I created for this project
I to get the stage height property.  I also found that loading flashvars
in an all as3.0 proect has issues too.  I had to set a timer event to
work around that issue too.   I prefer using flex because all this stuff
is moot under flex.

Has anyone else noticed these issues out there?

Thanks for your time.
Patrick






On May 4, 2007, at 4:23 PM, Alex Harui wrote:


        

        It has been instantaited and added as a child to Application
(unless it is a true downloadprogressbar preloader) but the entire
application is not on stage yet.

________________________________

        From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Michael Wills
        Sent: Friday, May 04, 2007 2:00 PM
        To: flexcoders@yahoogroups.com
        Subject: Re: [flexcoders] Acessing stage Height
        
        

        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: flexcoders@yahoogroups.com [mailto:flexcoders@
<mailto:flexcoders@> yahoogroups.com] On Behalf Of patricklemiuex
                Sent: Friday, May 04, 2007 12:48 PM
                To: flexcoders@yahoogroups.com
                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
                
                



        


 

Reply via email to