3 Replies Latest reply on Feb 18, 2010 7:14 AM by kglad

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

    Limon26 Level 1

      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?

        • 1. Re: load .swf into empty mc behind layer on main fla file
          kglad Adobe Community Professional & MVP

          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.

          • 2. Re: load .swf into empty mc behind layer on main fla file
            Limon26 Level 1

            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;

                }
            }

            • 3. Re: load .swf into empty mc behind layer on main fla file
              kglad Adobe Community Professional & MVP

              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.