[Papervision3D] MovieScene3D.getChild()

Patrick Matte | BLITZ PMatte at blitzagency.com
Mon Jun 18 15:50:12 EDT 2007


Yeah that's why I thought you guys should put it in the source code.

Or maybe just create a simple reference to the DisplayObject3D inside the container...
Like :

private function mouseDownEvent( e : MouseEvent ) : void {

                var cube:DisplayObject3D = e.target.displayObject3D;

                trace("cube = " + cube);

}


BLITZ | Patrick Matte 310-551-0200 x214
From: Papervision3D-bounces at osflash.org [mailto:Papervision3D-bounces at osflash.org] On Behalf Of John Grden
Sent: Monday, June 18, 2007 11:25 AM
To: Papervision3D at osflash.org
Subject: Re: [Papervision3D] MovieScene3D.getChild()

Hey Pat, I think that's useful
On 6/18/07, Patrick Matte | BLITZ <PMatte at blitzagency.com<mailto:PMatte at blitzagency.com>> wrote:

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);

}



_______________________________________________
Papervision3D mailing list
Papervision3D at osflash.org<mailto:Papervision3D at osflash.org>
http://osflash.org/mailman/listinfo/papervision3d_osflash.org



--
[  JPG  ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20070618/d131c5f0/attachment.htm


More information about the Papervision3D mailing list