首先,请查看我的SWF:http://krakow45.pl/spec/warcaby/Warcaby3D.html
你可以移动棋子并且效果很好。但问题是你翻译游戏板(按任意方向键)。在此之后你不能移动棋子。这是我的一小部分代码:
翻译:
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;
移动棋子:
private function MouseDown(event:MouseEvent):void
{
var pawn:Pawn = event.currentTarget as Pawn;
_xPos = pawn._xPos;
_yPos = pawn._yPos;
_txt.text = pawn._xPos + " - " + pawn._yPos + "\n";
pawn.startDrag();
}
答案 0 :(得分:0)
好的,我通过使用类似的东西解决了这个问题:(针对startStag())
private var _clicked:Boolean
private var _currentPawn:Pawn
private function MouseDown(event:MouseEvent):void
{
_clicked = true;
_currentPawn = event.currentTarget as Pawn;
// rest of my 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 my code
}