try add that ADDED_TO_STAGE at MyManager not myView
and if it still not work on you, just mod SimpleView constructor to wait for
stage before construct/init

hth

2009/12/9 mkupper <[email protected]>

> Thanks but I *believe* I've done that correctly and I still get null
> for the stage when I enter the constructor in SimpleView (which is a
> Sprite essentially). Here is some of the code:
>
> public class myView extends SimpleView
> {
>   public function myView()
>   {
>      addEventListener(Event.ADDED_TO_STAGE, addedHandler);
>      super("Test", "Character Load Test");
>   }
>
>   private function addedHandler(event:Event)
>   {
>      removeEventListener(Event.ADDED_TO_STAGE, addedHandler);
>   }
> }
>
> //Here is the calling class....
>
> public class MyManager extends UIComponent
> {
>   public var currView:myView;
>
>   public function MyManager()
>   {
>      super();
>      currView = new myView();
>      addChild(currView);
>    }
> }
>
>
> On Dec 8, 11:15 am, katopz <[email protected]> wrote:
> > try listen ADD_TO_STAGE event via container or parent before load
> SimpleView
> > should help
> >
> > hth
> >
> > 2009/12/9 mkupper <[email protected]>
> >
> > > The test class SimpleView accesses the stage in its constructor. The
> > > stage is always null because you can't do an addChild on it until it's
> > > been constructed. I have a class that  I was just attempting to get a
> > > simple mesh loaded and displayed with SimpleView, but even that seems
> > > to have problems. I think you used to be able to get to the stage from
> > > _root prior to AS3. And yes, I am calling addEventListener,
> > > removeEventListener, and addChild at the appropriate places. Does
> > > anyone have working code with the latest lib which uses SimpleView???
> > > Thanks!! This is really bothering me.
> >
> > --
> > katopzhttp://www.sleepydesign.com
>



-- 
katopz
http://www.sleepydesign.com

Reply via email to