you're right, this happened in Loader class when load success

> parent.addChild(handle);

parent.removeChild(this);


which mean you need to remove it via handle just like that
or you can try this


> package

{

import away3dlite.core.base.*;

import away3dlite.events.Loader3DEvent;

import away3dlite.loaders.*;

import away3dlite.templates.*;

 import flash.display.*;


> public class ExMQO extends BasicTemplate

{

override protected function onInit():void

{

var mqo:MQO = new MQO();

var loader:Loader3D = new Loader3D();

loader.addEventListener(Loader3DEvent.LOAD_SUCCESS, onSuccess);

loader.loadGeometry("assets/Messerschmitt_Bf_109.mqo", mqo);

}

 private function onSuccess(event:Loader3DEvent):void

{

scene.addChild(event.loader.handle);

scene.removeChild(event.loader.handle);

}

}

}


btw, i'll talk to team again maybe we can override removeChild in loader
class to remove handle also

thx

2009/9/19 Videometry <[email protected]>

>
> Sure that works, the confusing thing is if you add a loader, you can't
> remove it, but you can
> remove it's children, which you never added implicitly in the first
> place.
>
> scene.addChild(myObjectLoader);
> myObject = myObjectLoader.handle as ObjectContainer3D;
> scene.removeChild(myObject)
>
> If these were Sprites you wouldn't be able to remove "myObject" and
> you would be able to remove "myObjectLoader"
> When I try to remove myObjectLoader I get the message that it's not a
> DisplayObject, however removing myObject works.
>
>
> On Sep 18, 6:15 am, katopz <[email protected]> wrote:
> > do try this, work for me
> >
> > > package
> >
> > {
> >
> > import away3dlite.materials.*;
> >
> > import away3dlite.primitives.*;
> >
> > import away3dlite.templates.*;
> >
> > > public class ExSphere extends BasicTemplate
> >
> > {
> >
> > override protected function onInit():void
> >
> > {
> >
> > var sphere:Sphere = new Sphere(new WireframeMaterial(), 100, 10, 10);
> >
> > scene.addChild(sphere);
> >
> > scene.removeChild(sphere);
> >
> > }
> > }
> > }
> >
> > hth
> >
> > 2009/9/18 themightyatom <[email protected]>
> >
> >
> >
> > > Anybody found a way to remove an object from a scene in Away3dLite?
> > > The ".removeChildByName" from the main branch isn't in the new engine.
> > > To add objects we use the addChild command, but removeChild dosn't
> > > work
> > > as the object is not actually a flash displayObject (i think!)
> >
> > > Any ideas greatly appreciated ;O)
> >
> > > Cheers
> >
> > > PS
> >
> > --
> > katopzhttp://www.sleepydesign.com
>



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

Reply via email to