tags:

views:

142

answers:

3

I'm trying to load an external swf movie then adding the ability to drag it around the stage, however whenever I try to do this I just hit a dead end. Are there any limitations on what you can set be draggable or clickable? An example of what I'm 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 code above i can only get it to recognise a click on the movie itself if it is over a click on the textfield, but this really needs to work on any part of the movie. Any ideas?

A: 

No one at all?

John_
+1  A: 

Something of a shot in the dark, but could you make a transparent movie clip on top of the movie that's loaded that is dragged around, which moves the swf underneath?

mgbennet
+2  A: 

If there is empty space in your content, Flash will treat it like you have clicked THROUGH the clip to the stage below. Try adding a transparent square to the bottom layer of the content you're loading.

Also try setting:

ldr.content.mouseChildren = false;

Iain