Trouble…

Software: Away3D 3.x

Bill7745, Newbie
Posted: 27 June 2013 02:05 AM   Total Posts: 22

Hello,
I’m having trouble with the following code not performing right:

_soldier.addEventListener(MouseEvent3D.MOUSE_DOWN, _rookOnMouseDown);
_board.addEventListener(MouseEvent3D.MOUSE_UP, _rookOnMouseUp);
_soldier.useHandCursor = true;


private function _rookOnMouseDown(ev : MouseEvent3D) : void
{
_yellowBase.visible = true;
_SoldierMD = true;
 
if(_yellowBase.visible){
_board.addEventListener(MouseEvent3D.MOUSE_MOVE, _rookOnMouseMove);
}

 
_soldier.mouseEnabled = false;
_board.useHandCursor = true;
_movieClip.stopCountrySelection = true;
 
 
}

private function _rookOnMouseMove(ev : MouseEvent3D) : void
{
_SoldierMD = true;
if(_yellowBase.visible){
_soldier.x = ev.sceneX;
_soldier.z = ev.sceneZ;
}
}

when _SoldierMD = true then it makes _yellowBase visible in the game loop.

Problem is, it works like half the time. I have :
if(_yellowBase.visible){
_soldier.x = ev.sceneX;
_soldier.z = ev.sceneZ;
}

there so the soldier won’t move without it displaying the yellow base, because it was moving without it before. Anyway, is there another way I can move a 3d object I could try so maybe it will fix the problem? Or if anyone knows how I could fix it let me know. Thank you You can see the problem in the attached file.

 

File Attachments
BillsScroll4.swf  (File Size: 850KB - Downloads: 189)
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X