flash - drag and drop actionscript issue, how to fix? -


i have problem actionscript drag , drop + clone. object gets stuck after few instances, when overlaps instance. each object movieclip, vector graphic imported form adobe illustrator.

what must change make not stuck? borrowed stackoverflow question: drag, drop , clone - flash as3

here actionscript:

 import flash.display.movieclip;   (var = 1; < 27; i++)  {     this["object" + i].addeventlistener(mouseevent.mouse_down, onstart);     this["object" + i].addeventlistener(mouseevent.mouse_up, onstop);  }   var sx = 0, sy = 0;   function onstart(e)  {     sx = e.currenttarget.x;     sy = e.currenttarget.y;     e.currenttarget.startdrag();  }   function onstop(e)  {     if (e.target.droptarget != null &&          e.target.droptarget.parent == dest)     {         var objectclass:class =          getdefinitionbyname(getqualifiedclassname(e.currenttarget)) class;         var copy:movieclip = new objectclass();         this.addchild(copy);         copy.x = e.currenttarget.x;         copy.y = e.currenttarget.y;     }      e.currenttarget.x = sx;     e.currenttarget.y = sy;     e.currenttarget.stopdrag(); } 

thank you.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -