Ok - let me provide some code. First define one of many images. That's
what ChessPiece is.

<ns:ChessPiece id="img_bqr" x="{Number(ary.getItemAt(0))}"
y="{Number(ary.getItemAt(0))}" source="{png_br}" color="black"
rank="rook"   pos="a8" mouseDown="movePiece(event)"/>

Then in the movePiece function create the event listener. cv is my
canvas on which the images are:

private function movePiece(e:MouseEvent):void
{
if (drag)
{
cv.currentTarget.addEventListener(MouseEvent.MOUSE_MOVE, dragPiece);

Then the dragPiece callback:

private function dragPiece(e:MouseEvent):void
{
  e.currentTarget.x=cv.mouseX-40;
  e.currentTarget.y=cv.mouseY-40;
}



Reply via email to