Reputation: 543
I'm having a panel which shows an image and control bar with buttons in the form of thumbnail image of right mark. When a user clicks on the thumbnail of right mark I want to stick the thumbnail image of that right mark to the mouse pointer and when he clicks on the image, the thumbnail related image should be paste on the image. Same concept of drag and drop with click event.
Upvotes: 1
Views: 400
Reputation: 2288
Try this:to pick button single click and to drop you have to do double click.
<mx:LinkButton id="myLButton" height="100" width="100" color="red" label="Click"
doubleClickEnabled="true" click="myLButton.startDrag(false)" doubleClick="myLButton.stopDrag()"/>
Upvotes: 1
Reputation: 11912
Your question is still pretty hard to understand, but I'm fairly certain that what you need is Sprite#startDrag() and Sprite#stopDrag().
Here's a little example setup to get you started:
<s:layout>
<s:HorizontalLayout/>
</s:layout>
<s:Button label="pick it up" click="myImage.startDrag(true)" />
<s:Image id="myImage" source="@Embed('test.png')" />
<s:Button label="drop it" click="myImage.stopDrag()" />
Note that I set the lockCenter
argument to true. This will make the Image stick to the mouse. Otherwise you would start dragging the image from its original location.
Upvotes: 2