Mesh 3DS and MouseEnable issue

Software: Away3D 4.x

alx1507, Newbie
Posted: 25 August 2011 04:55 PM   Total Posts: 4

Hi again,
I’m having a hard time getting my head around this. I have a simple sphere that i’m loading as a .3DS and I want to make it mouse enabled.  From the stuff I’ve gathered in examples and around this forum the next step is to make a mesh for it.(?)  I poached some of the code from examples and tried to form it for my needs and this is what I’ve gotten so far:

Loader3D.enableParser(Max3DSParser);
   
   
_container = new Loader3D();
   
_container.scale(1);

   
_container.load(new URLRequest('assets/models/Spheres_01.3ds'));
   
_container.200;
   
_container.0;
   
_container.0;
   
_view.scene.addChild(_container);
   
   var 
mesh Mesh;
   for (var 
int 0_container.numChildren; ++l{
    mesh 
Mesh(_container.getChildAt(l));
    
mesh.geometry.scale(1);
    
mesh._container.z;
    
mesh._container.x;
    
mesh._container.y;
    
mesh.material material;
    
mesh.mouseEnabled true;
    
mesh.addEventListener(MouseEvent3D.CLICK,onStageDown);
   

The .3DS loads wonderfully but I still am not getting any sort of mouse reaction from it.  Not sure if i’m on the right track or if I need to step in a new direction.

Thanks for any help!
-Alex

   

Avatar
theMightyAtom, Sr. Member
Posted: 25 August 2011 04:59 PM   Total Posts: 669   [ # 1 ]

You need to run your for loop after the mesh has loaded.
Make that into a seperate function and call it when container has finished loading. There’s several examples in the GitHub broomstick examples repository.

Good luck!

   

alx1507, Newbie
Posted: 25 August 2011 05:09 PM   Total Posts: 4   [ # 2 ]

Great, that did the trick!
I need to stop trying to cut corners haha.

Thanks for the quick reply,
Alex

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X