Jump to content

duplicate and start drag


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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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