dragging images from web pages?

Malte Brill malte.brill at t-online.de
Wed Jun 23 08:46:57 EDT 2004


Hi Terry.

I did a quick and dirty test.

create a stack.

Script:

on dragenter
  set the acceptdrop to true
end dragenter
on dragDrop
  put the dragData into theURL
  if char -4 to -1 of theURL is in field "fileextensions" then
    set the filename of img webimage to theURL
    put the mouseLoc into where
    create image
    set the rect of the last image to the rect of img "webimage"
    set the itemdel to "/"
    set the name of the last image to the last item of theURL
    set the imagedata of the last image to the imagedata of image "webimage"
    set the alphadata of the last image to the alphadata of image "webimage"
    set the topleft of the last image to where
  end if
end dragDrop

The stack needs the following controls:

-an empty field that covers the whole card to receive the dragDrop messages.
 qpaque can be false on the bottommost layer.

-a newly created image called "webimage"

-a field called "fileExtensions" with the following content:
 .jpg .gif .png

Works here (in case one dragged the image correctly check the messagebox
output. If it is a valid url it works)...

Best,

Malte



More information about the use-livecode mailing list