mercredi 22 juin 2016

Clone object when dragging

I am trying to clone my object when dragging (the object is called pink_key).

Unfortunately, when dragging, the object is not cloned.

import flash.events.MouseEvent;

this.addEventListener(MouseEvent.MOUSE_DOWN, startDragging, true);
this.addEventListener(MouseEvent.MOUSE_UP, stopDragging, true);

function startDragging(e:MouseEvent) {

    var clone_pink_key:MovieClip = new MovieClip();
    clone_pink_key.graphics.copyFrom(pink_key.graphics);

    addChild(clone_pink_key);
    clone_pink_key.x=60;

    pink_key.startDrag();


}

function stopDragging(e:MouseEvent) {
    pink_key.stopDrag();
}

Any help appreciated!

Aucun commentaire:

Enregistrer un commentaire