Drag-And-Drop Image Fun
Tuviah M Snyder
diskot123 at juno.com
Thu May 29 06:21:01 EDT 2003
>However, here's my take on things (UNTESTED) :
>- since it wants .PNG formatted image data, you'll
>need to convert both its imageData _and_ its
>maskData/alphaData into that format
>- you might want to look at the 'export' command in
>the dictionary ; it allows you to export to a file or
>even a container in a certain format (aha!)
>- you can then stuff this in the dragData["image"] and
>give it a whirl.
Just tested it and there seems to be a bug where dragging and dropping
images within Rev does not work. Will fix for 2.1. This is how it was
supposed to work:
source image:
on mousedown
set the dragdata["image"] to the text of me -- where me is an
image
end mousedown
target image:
on dragenter
if "image" is among the items of the keys(the dragdata) then --if
image is one of the available drag types
set the acceptdrops to true
end if
end dragenter
on dragdrop
if "image" is among the items of the keys(the dragdata) then
put the dragdata["image"] into me
end if
pass dragdrop
end dragdrop
The workaround is:
on mousedown
set the dragdata["text"] to base64encode(the text of me)
--base64encode binary data as text
end mousedown
target image:
on dragenter
if "text" is among the items of the keys(the dragdata) then
set the acceptdrops to true
end if
end dragenter
on dragdrop
if "text" is among the items of the keys(the dragdata) then
put base64decode(the dragdata["image"]) into me
end if
pass dragdrop
end dragdrop
Tuviah Snyder <tuviah at runrev.com> <http://www.runrev.com/>
Runtime Revolution Limited - Software at the Speed of Thought
More information about the use-livecode
mailing list