How can I bring in front the objects in adobe flash when dragging and send it back.
Its a mobile game. Adobe flash cs6
Its a mobile game. Adobe flash cs6
but i have many objects to be drag. it is possible to have one function?
Leo Angelo Laude wrote:
but i have many objects to be drag. it is possible to have one function?
yes, that's why i posted, '(but you should actually be using one function for all your startDrag() and another function for all your stopDrag() methods so you don't have to write the same code repeatedly.)'
you should be using something like:
var draggedObject:MovieClip;
var draggableObjectsA:Array=[...];
for(var i:int=0;i<draggableObjectsA.length;i++){
draggableObjectsA.addEventListener(MouseEvent.MOUSE_DOWN,startdragF);
draggableObjectsA.origIndex=draggableObjectsA.parent.getChildIndex(draggableObjectsA);
}
function startdragF(e:MouseEvent):void{
draggedObject=e.currentTarget;
draggedObject.startDrag();
draggedObject.parent.addChild(draggedObject);
stage.addEventListener(MouseEvent.MOUSE_UP,stopdragF);
}
function stopdragF(e:MouseEvent):void{
draggedObject.stopDrag();
draggedObject.parent.addChildAt(draggedObject.origIndex);
stage.removeEventListener(MouseEvent.MOUSE_UP,stopdragF);
}
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.