[Papervision3D] Extending DisplayObject3D, help!!
Steven Hargrove
steven.hargrove at gmail.com
Fri Oct 26 11:56:09 PDT 2007
So, I am extending DisplayObject3D. Not a problem, works great.
However, previous to this, I was just creating a plane, and doing this:
plane.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK,
onWallObjectClick);
That worked great however now the plane has been replaced by the newly
created class, WallObject. For some reason now, this doesn't work:
wallObj.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK,
onWallObjectClick);
I'm not sure what the best way is to assign an event listener for the plane
that is now a child of WallObject. Here is the WallObject class:
Thanks in advance, and sorry for the confusion in my question!
public class WallObject extends DisplayObject3D
{
protected var request:URLRequest;
protected var loader:Loader;
protected var loaderContentContainer:Sprite;
public var var frontPlane:Plane;
public var var backPlane:Plane;
public function WallObject()
{
}
public function load(_url:String):void
{
// url request
request = new URLRequest(_url);
// loader
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.INIT,
onAssetLoadInit);
loader.load(request);
}
protected function onAssetLoadInit(evemt:Object):void
{
loaderContentContainer = new Sprite();
loaderContentContainer.addChild(loader.content);
// materials
var frontMaterial:PreciseMovieMaterial = new
PreciseMovieMaterial(loaderContentContainer, true);
frontMaterial.interactive = true;
var backMaterial:WireframeMaterial = new
WireframeMaterial(0xFF00FF);
frontPlane = new Plane(frontMaterial, 128, 128);
backPlane = new Plane(backMaterial, 128, 128);
backPlane.rotationY = 180;
frontPlane.z = 1;
this.addChild(backPlane);
this.addChild(frontPlane);
}
--
Steven Hargrove
stevenhargrove.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20071026/770c43bb/attachment-0001.html
More information about the Papervision3D
mailing list