Jump to content

duplicate and start drag


valentinaCom
 Share

Recommended Posts

Hi :)

 

I have a button that when I press on it, it duplicate (I add a new button) and I want it to automaticly start dragging the new one. 

right now I need to press again in the new btn to start the drag.

 

here's my code:

    addItemsToMenu:function(){        var btn = game.add.button(50,50, 'obg');        btn.anchor.set(0.5);        btn.onInputDown.add(this.duplicatePic,this);    },    duplicatePic:function(e){        var newBtn = game.add.button(e.x, e.y, e.key);        newBtn.anchor.set(0.5);        newBtn.input.enableDrag(true);        newBtn.events.onDragStart.add(this.dragItem,this);        newBtn.events.onDragStop.add(this.stopDraItem,this);    }

help? :)

 

thank you!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...