[Papervision3D] MovieScene3D.getChild()

Patrick Matte | BLITZ PMatte at blitzagency.com
Mon Jun 18 14:09:06 EDT 2007


Hey Papervision guys, tell me if there's an easier way of doing this but I wrote this method for the MovieScene3D and I think it's pretty useful so maybe you'd like to add it. So here's the method :

public function getChild(container:Sprite):DisplayObject3D {
                var child:DisplayObject3D;
                for(var i in spriteList){
                                if(container == spriteList[i]){
                                                child = i;
                                }
                }
                return child;
}

And it's used like this :

scene = new MovieScene3D(container);
for(var i=0;i<20;i++){
                var plane:Plane = new Plane();
                scene.addChild(plane);
                plane.container.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownEvent);
}

private function mouseDownEvent( e : MouseEvent ) : void {
                var cube:DisplayObject3D = scene.getChild(e.target as Sprite);
                trace("cube = " + cube);
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20070618/8e59970c/attachment.htm


More information about the Papervision3D mailing list