actionscript 3 - Moving object in AS3 while it is translated by Matrix3D -


first, please @ swf: http://krakow45.pl/spec/warcaby/warcaby3d.html

you can move pawns , works pretty well. problem starts whem translate game board (by pressing of direction keys). after cant move pawns. here little piece of code:

translation:

case keyboard.left:     _matrix = new matrix3d();  _matrix.appendtranslation(0, -200, 0); _matrix.appendrotation(_rot++, vector3d.x_axis); _matrix.appendtranslation(0, 200, _depth);  _table._board.transform.matrix3d = _matrix;  break; 

moving pawn:

private function mousedown(event:mouseevent):void     {         var pawn:pawn = event.currenttarget pawn;          _xpos = pawn._xpos;         _ypos = pawn._ypos;          _txt.text = pawn._xpos + " - " + pawn._ypos + "\n";          pawn.startdrag();     } 

ok, solved using this: (against startstag() )

private var _clicked:boolean private var _currentpawn:pawn  private function mousedown(event:mouseevent):void {     _clicked = true;     _currentpawn = event.currenttarget pawn;     // rest of code }  private function mousemove(event:mouseevent):void {     if(_clicked)     {         _currentpawn.x = mousex;         _currentpawn.y = mousey;     } }  private function mouseup(event:mouseevent):void {     _clicked = false; // rest of code } 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -