Let\'s say I want a web page that contains a Flash applet and I\'d like to drag and drop some objects from or to the rest of the web page, is this at all possible?
B
DISCLAIMER I haven't tested this code at all, but the idea should work. Also, this only handles the dragging to a flash movie.
Here's some Actionscript 3.0 code which makes use of the ExternalInterface class.
import flash.display.Sprite;
import flash.external.ExternalInterface;
import flash.net.URLLoader;
import flash.net.URLRequest;
if (ExternalInterface.available) {
ExternalInterface.addCallback("handleDroppedImage", myDroppedImageHandler);
}
private function myDroppedImageHandler(url:String, x:Number, y:Number):void {
var container:Sprite = new Sprite();
container.x = x;
container.y = y;
addChild(container);
var loader:Loader = new Loader();
var request:URLRequest = new URLRequest(url);
loader.load(request);
container.addChild(loader);
}
Here's the HTML/jQuery code
XHTML 1.0 Transitional Template