Sorry, didn't read the whole thing.

 

The stage should be there for the root class right away.

 

-Alex

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Michael Schmalle
Sent: Thursday, May 31, 2007 4:17 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: Accessing the illusive stage Object
through sprite (a near impossible feat)

 

Alex,

I think he said he was using an AS3 project. There is no
applicationComplete event right?

Peace, Mike

On 5/31/07, Alex Harui < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
wrote:

applciationComplete

 

systemManager.stage should be available to you at initialize

 

________________________________

From: flexcoders@yahoogroups.com [mailto: flexcoders@
<mailto:flexcoders@> yahoogroups.com <http://yahoogroups.com> ] On
Behalf Of patricklemiuex
Sent: Thursday, May 31, 2007 2:15 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Accessing the illusive stage Object through
sprite (a near impossible feat)

 

Michael, 

Thanks so much, where was that event hiding? I was using a hackish
timer to do the job. However, your solution doesn't work from within
the class that I create (haven't tried outside yet). Is there a way
to do this all from inside the class I am using, or does the event
listener have to sit outside the class? 

Really, I think it would have been better, but maybe it's not even
possible to make the constructor function of classes automatically
have access to the stage object on instantiation?

Also, to trap keyboard events the only way I could make it works is
the following:

stage.focus = this.parent;
this.stage.addEventListener(KeyboardEvent.KEY_DOWN,keyHandler);
this.stage.addEventListener(KeyboardEvent.KEY_UP,keyHandler);

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Michael Schmalle"
<[EMAIL PROTECTED]> wrote:
>
> Hi,
> 
> The stage object does not get defined until right at the end of the
players
> init cycle.
> 
> Try listening to the Sprites Event.ADDED_TO_STAGE event, then access
the
> stage object.
> 
> Peace, Mike
> 
> On 5/31/07, patricklemiuex <[EMAIL PROTECTED]> wrote:
> >
> > Dear Actionscript wizards:
> >
> > I have an all as3.0 project.
> >
> > I can never seem to access the stage object (I've posted several
times
> > and never can get any appropriate solutions)? i thought this was
> > automatic with every class that extends sprite... I get a null
object
> > reference trying to access the stage object. I must be doing
> > something incorrectly, though I have studied this in a few places.
> >
> > public class AbstractSlideView extends Sprite
> > {
> > protected var _data:PictureProviderXML;
> > //protected var _data:PictureProvider;
> > private var _paramObj:Object;
> >
> > public function AbstractSlideView() {
> > var timer:Timer = new Timer(1000,1);
> > timer.addEventListener(TimerEvent.TIMER, installVars);
> > timer.start();
> > this.stage.focus = this;
> > this.addEventListener(KeyboardEvent.KEY_DOWN,keyHandler);
> > this.addEventListener(KeyboardEvent.KEY_UP,keyHandler);
> > }
> >
> > 
> >
> 
> 
> 
> -- 
> Teoti Graphix
> http://www.teotigraphix.com <http://www.teotigraphix.com> 
> 
> Blog - Flex2Components
> http://www.flex2components.com <http://www.flex2components.com> 
> 
> You can find more by solving the problem then by 'asking the
question'.
>




-- 
Teoti Graphix
http://www.teotigraphix.com <http://www.teotigraphix.com> 

Blog - Flex2Components
http://www.flex2components.com <http://www.flex2components.com> 

You can find more by solving the problem then by 'asking the question'. 

 

Reply via email to