[Papervision3D] How to capture events from a MXLM component in a MovieMaterial?
aboteler
aboteler at harris.com
Tue Aug 4 10:05:47 PDT 2009
Hello,
I have a 3D virtual world containing 50+ objects where each has a separate
instantiation of an MXML Canvas component attached to a MovieMaterial
painted on the objects front face. The component has a button, slider,
checkbox, and a radio button. Also in that MXML file I specify an event
handler for when a click happens.
Unfortunately, the event handler is never called. I need help with
understanding the eventing flow in this case and how to fix it. I believe
it has to do with the event going to PV3D and then somehow needs to flow to
the particular instantiation.
Thanks,
Aaron
FYI,
Here's the MXML class
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
width="200" height="200" backgroundColor="#FFEA00">
<mx:VBox>
<mx:Button id="btn" label="button" width="80" />
<mx:HSlider width="230" />
<mx:CheckBox label="Checkbox" />
<mx:RadioButton label="Radio" />
</mx:VBox>
<mx:Script>
<![CDATA[
public function youClicked(evt : MouseEvent) : void
{
trace("mouse button clicked");
}
]]>
</mx:Script>
</mx:Canvas>
And, here's the section of code that adds it to the stage and cube:
var material:MovieMaterial;
material = new MovieMaterial(new MXMLNode(),false,true,true);
material.smooth = true;
material.interactive = true;
material.allowAutoResize = false;
// Material list with MovieMaterial used on the front, the rest being flat
shaded
var colorMaterial:MaterialObject3D = new ColorMaterial(0x02AABB);
colorMaterial.interactive = true;
var materialList:MaterialsList = new
MaterialsList({"all":colorMaterial,"front":material});
// create a new interactive projector
var projector:ProjectorCube = new ProjectorCube(id,materialList, NODE_WIDTH,
NODE_DEPTH, NODE_HEIGHT);
projector.addEventListener(InteractiveScene3DEvent.OBJECT_DOUBLE_CLICK,
onMouseDoubleClickOnObject);
projector.addEventListener(InteractiveScene3DEvent.OBJECT_OVER,
onMouseOverObject);
projector.addEventListener(InteractiveScene3DEvent.OBJECT_OUT,
onMouseOutObject);
// add it to the display list
node.visible=false;
this.addChild(node);
// add the projector to the scene, being part of the object group
scene.addChild(projector);
--
View this message in context: http://www.nabble.com/How-to-capture-events-from-a-MXLM-component-in-a-MovieMaterial--tp24812045p24812045.html
Sent from the Papervision3D mailing list archive at Nabble.com.
More information about the Papervision3D
mailing list