flexgeek

drag & drop example

Posted on: March 15, 2007

banner3

Blog moved to http://blog.flexgeek.in

View the post here – http://blog.flexgeek.in/?p=10

About these ads

9 Responses to "drag & drop example"

cool example

It looks a bit smoother if you drop it off at more accurate point. So instead of dropping the image at the mouseX, drop it at mouseX – (dragInitiator.width/2)

This centers the drop a little better. Do this for mouseX and mouseY.
(for mouseY use dragInitiator.height)

can you give me the hint for the inverse operation? I need to drag an image over a list, and I can’t find out the row index.

Thank you very much folk…. Cool Example…

Geddesigns comment is incorrect, although his idea is right. I would note that if people are going to post such comments that they should try to be accurate else it throws so many people off. Bad Geddesign! dragInitiator.width and height are the settings for the TileList control. No good! I for example am dragging an image within the TileList control so want the width and height of that image. In my case it is a fixed size so I use that. Furthermore, there is no mouseX and mouseY available for the drag event. There is instead localX and localY attributes. So I used the following which gave me the desired result:

img.x = event.localX – (30/2);
img.y = event.localY – (30/2);

I agree too, cool example!

thanks dude
it helped

But Mark it will work only if you have images of similar dimesnsions otherwise it will not be useful..isn’t it?
So its not the permanent solution dude!

Thank you for this great example!
Your “FormattedStepper – NumericStepper with formatting support” is great too!!
Thank you for sharing! =)

Looks good, but I’m working with Flex 3, and in order to get the example to work I had to change

dragProxy.setActualSize(event.currentTarget.width,event.currentTarget.height);

to

dragProxy.height=event.currentTarget.height;
dragProxy.width=event.currentTarget.width;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: