Object appears wrong frame
Hello, I'm making simple drag and drop game for several letters. Some of the letters appear in the wrong frame and generate an error when clicked.
I'm attaching an example of the file i'm working on, if someone can help would be great (Test2.fla - Google Drive ). A, B, C are fine but XYZ carry on to the next frame. what can be done to stop this.
stop();
var orig1X:Number=A1.x;
var orig1Y:Number=A1.y;
A1.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);
A1.addEventListener (MouseEvent.MOUSE_UP, item1Release);
function dragTheObject(event:MouseEvent):void {
var item:MovieClip=MovieClip(event.target);
item.startDrag();
var topPos:uint=this.numChildren-1;
this.setChildIndex(item, topPos);
}
function item1Release(event:MouseEvent):void {
var item:MovieClip=MovieClip(event.target);
item.stopDrag();
if (pos1.hitTestPoint(item.x,item.y)) {
item.x=pos1.x;
item.y=pos1.y;
} else {
item.x=orig1X;
item.y=orig1Y;
}
};
A1.buttonMode = true;
So this is the code im using for the drag and drop game
