PDA

View Full Version : Failed to assign action to button/MC


youwh
05-06-2008, 08:10 PM
I wanted to assign action to my MC when I click / release. But if I put it like cube.addListerner, it won't work.

Please help me.

This is where I have the code:
for (var i:Number=0; i < picList.length(); i++) {
cube=new Cube(materials,60,2,80,10,10,10);
cube.name="cube" + i;// set instance name

//trace(cube);
cube.x=Math.random() * 950 - 460;
cube.y=Math.random() * 700 - 330;
cube.z=-5;
cube.rotationZ=Math.random() * 360;

scene.addChild(cube);
}
cube.addEventListener(InteractiveScene3DEvent.OBJE CT_CLICK,objectPress);
cube.addEventListener(MouseEvent.MOUSE_UP,objectRe lease);

}
//----------------------------------------------------------------------------------------

private function objectPress(e:InteractiveScene3DEvent):void {
trace(materials);
startDrag();
}
private function objectRelease(e:MouseEvent):void {
stopDrag();
}

youwh
05-09-2008, 12:26 AM
anyone?

amarghosh
05-09-2008, 05:16 AM
which 3d engine r u using? in away3d, its cube.addOnMouseDown(listener); don't know abt rest

youwh
05-09-2008, 10:14 AM
i'm using papervision 3d

amarghosh
05-09-2008, 12:28 PM
it should be the same then. because away3d was developed as an extension of papervision3d. so i guess that would be same. try it