How do you display an image by dragging it on to a stack?
This lesson will show you how to display an image file that is dragged on to a stack, for example from the desktop.
Creating the stack

Firstly create a new stack and call it Image Viewer. Add an image area to the stack by dragging it over from the Tools Palette(1). This image area will be used to display the image that is dragged on to the stack. Call the image Display.(2)
Accepting a dragged image
The first stage is specifying that the image can accept dragged items and what action it should take. This is done by setting the dragAction property in the dragEnter message. In this case we want the image to copy the data that is dragged on to it.
Add the following handler to the image script.
on dragEnter
set the dragAction to "copy"
end dragEnter
Displaying the dragged image

To get information about what has been dragged on to the image we use the dragData property. The dragData is an array and in this case we are interested in the file that was dragged so we use the dragData["files"] to retrieve the filepath. We can then set the filename of our image to the path to the image file that was dragged and it will be displayed.
Add the following handler to the image script.
on dragDrop
set the filename of me to the dragData["files"]
end dragDrop
Alternatively you can set the text of the image to the content of the file using the URL keyword
on dragDrop
set the text of me to url ("binfile:" & the dragData["files"])
end dragDrop
This works for dragging and dropping photos from my computer, but when I tried to drag and drop and image displayed in my web browser it didn't work. Also, the image I dragged in from my computer resized the image display. Is there a follow-up lesson that explains how to deal with some of these issues?