Skip to main content
February 17, 2010
Question

load .swf into empty mc behind layer on main fla file

  • February 17, 2010
  • 1 reply
  • 971 views

Is it possible to load a .swf into an empty mc that is dynamically created, behind a layer on my main flash file?

I want the loaded .swf to load behind the interface buttons on my main flash file?  Is that possible or do I need

to put the interface buttons on a separate .swf and load that .swf in?

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
February 17, 2010

yes, it's possible.

because all dynamically created movieclips are at depth 0 or greater AND all objects created in the authoring environment are at negative depths (unless you create thousands), you'll need to use apply swapDepths() to your target movieclip and move it to a negative depth.  that will probably be somewhere in the neighborhood of negative 2**14.

February 18, 2010

This is the code you were helping me with before.  We do have swapDepths() in the function but when I load in my .swf file, it always loads on top of the interface?

this.createEmptyMovieClip("target1MC",this.getNextHighestDepth());

this.createEmptyMovieClip("target2MC",this.getNextHighestDepth());

var currMC:MovieClip = target2MC;

target1MC._alpha = 0;

function loadF(y:Number, d:Number) {
    otherTargetF(currMC).swapDepths(Math.max(target1MC.getDepth(), target2MC.getDepth()));

    mcl.loadClip("floors_swf/"+y+"_"+d+".swf",otherTargetF(currMC));

}

function otherTargetF(mc:MovieClip):MovieClip {

   if (mc._name == "target1MC") {

       return target2MC;

          } else {

        return target1MC;

    }
}

kglad
Community Expert
Community Expert
February 18, 2010

again, "because all dynamically created movieclips are at depth 0 or greater AND all objects created in the authoring environment are at negative depths (unless you create thousands), you'll need to use apply swapDepths() to your target movieclip and move it to a negative depth.  that will probably be somewhere in the neighborhood of negative 2**14."

target1MC and target2MC are dynamically created.  they have depths greater than -1.

use the getDepth() method to check the depths of movieclips in your layers you want to be on top.  then use swapDepths on target1MC and target2MC to move them below.