Flash loader and drag and drop
I am trying to load an external swf movie and then add the ability to drag and drop it across the stage, however whenever I try to do it I just run into a dead end. Are there any restrictions on what you can install, drag and drop or click? An example of what I am doing is below:
public function loadSwf(url:String, swfUniqueName:String)
{
var ldr:Loader = new Loader();
var url:String = "Swfs/Label.swf";
var urlReq:URLRequest = new URLRequest(url);
ldr.load(urlReq);
ldr.contentLoaderInfo.addEventListener("complete", loadCompleteHandler);
}
private function loadCompleteHandler(event):void{
var ldr = event.currentTarget;
// These are only here because I can't seem to get the drag to work
ldr.content.doubleClickEnabled = true;
ldr.content.buttonMode = true;
ldr.content.useHandCursor = true;
ldr.content.mouseEnabled = true;
ldr.content.txtLabel.mouseEnabled = true;
this.addChild(ldr.content);
ldr.content.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down);
}
mouse_down = function(event) {
trace(event.target);
}
Using the above code, I can only get it to recognize a click on the movie itself if it clicks on the text box, but this is really necessary to work with any part of the movie. Any ideas?
0
source to share
2 answers