I figured out a hack. I added the plane to the scene and then pushed
it into an array so I could check on it later. There is a lot more to
the code, but maybe this will help somebody.
var zombieName:MovieClip = _zombies[_id] as MovieClip;
var material:MovieMaterial = new MovieMaterial(zombieName,
{interactive: true, transparent:true});
var materialMC:MovieClip = material.movie as MovieClip;
var zombiePlane:Plane = new Plane({ material: material, smooth: true,
rotationX: 90, z: zPos, width: 85, height: 187, x: _mathUtils.randRange
(-110, 130), y: _yPos})
_viewPort3D.scene.addChild(zombiePlane);
zombiesOnScreen.push({planeUsed: zombiePlane, mat: materialMC});
materialMC.addEventListener(MouseEvent.CLICK, doZombieDestroy);
Then, in another method:
private function doZombieDestroy(event:MouseEvent):void
{
for each ( var zombie:* in zombiesOnScreen )
{
// checks to see if the event.target (material clicked)
matches an object in the array
if ( event.target == zombie.mat )
{
// after the object in the array with the
matching material is found,
// remove the plane associated with it
_viewPort3D.scene.removeChild
(zombie.planeUsed);
}
}
}
On Oct 8, 4:48 pm, Li <[email protected]> wrote:
> Do you have another variable called zombiePlane? Maybe you've declared it
> globally in the class as well...
>
> Where is zombiePlane declared? If it was created within a method, are you
> removing it and tracing it in the same method it has been created? Beyond
> that I can't think of anything.