MouseEvent3D

Software: Prefab3D

careca, Newbie
Posted: 29 June 2012 04:43 PM   Total Posts: 14

how do I use MouseEvent3D? I tried to put in each mesh that is exported, but without success!

   

Richard Olsson, Administrator
Posted: 30 June 2012 09:39 AM   Total Posts: 1192   [ # 1 ]

What do you mean? Do you want to listen for mouse events on a mesh? Then just do the following, similarly to what you would do in regular Flash.

mesh.mouseEnabled = true;
mesh.addEventListener(MouseEvent3D.MOUSE_UP, myHandlerFunction);

   

careca, Newbie
Posted: 01 July 2012 12:33 PM   Total Posts: 14   [ # 2 ]

I did it. But do not get the events.
Any reason that might be blocking the event?

   

Richard Olsson, Administrator
Posted: 01 July 2012 12:36 PM   Total Posts: 1192   [ # 3 ]

Make sure you have mouseEnabled = true and mouseChildren = true on the object and all it’s ancestor (parent, parent of parent et c.) Otherwise I think you will have to explain your set up better for anyone to be able to help.

   

careca, Newbie
Posted: 01 July 2012 03:31 PM   Total Posts: 14   [ # 4 ]

I use prefab to export to Class.
Then, in the class I have:

var cabowasc_11Data:Cabowasc_11Data = new Cabowasc_11Data();
   var 
geomcabowasc_11:Geometry cabowasc_11Data.geometryData;
   var 
cabowasc_11_rd:Vector.<Number> = Vector.<Number>([36.42613983154297,-8.70840835571289,-23.093284606933594,0,21.7625789642334,30.752479553222656,22.730487823486328,0,11.641575813293457,-30.239850997924805,29.76617431640625,0,-25.95755386352539,17.96571159362793,-34.0360107421875,1]);

var 
cabowasc_11:Mesh buildMesh(geomcabowasc_11cabowasc_11_rd"cabowasc_11"getMaterialFromID("mat1"), cont_0); 

I make:
cabowasc_11.mouseEnabled = true;
cabowasc_11.addEventListener(MouseEvent3D.Click, myFunction);

but the event don’t fire!

 

   

Richard Olsson, Administrator
Posted: 01 July 2012 03:45 PM   Total Posts: 1192   [ # 5 ]

This sounds very odd. Have you tried any other event types (e.g. MOUSE_UP)?

This may be a bug with the picking system, but since you’re using Prefab I’m guessing that you’re using a fairly old version of the engine codebase. If it is a bug it will likely have been fixed already in the release branch of the github repository. But I’m afraid that version is likely not compatible with the Prefab AS3 export yet.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X