5 Replies Latest reply on May 17, 2011 1:09 AM by jfweber

    getNextHighestDepth

    sbusig

      My external swf file utilizes getNextHighestDepth for several containers. The issues is that when I place this file within a main swf if appears over my static text and buttons. I have defined the depth in the main swf as 3 and the static text is layered above the action command placing the external swf. How do i keep the static text and buttons above anything, specifically the external swfs?

       

      Thanks-

       

      Steve

        • 1. Re: getNextHighestDepth
          jfweber

          Why dont you just use Flash IDE to arrange your layers in a way that the layer of the container where the ext. SWF is loaded in is below the layer where your text is? Avoid loading your ext. SWF to root or stage and assign a movieclip where it is loaded to like:

           

          container.loadMovie("external.swf", "myExtSWF", container.getNextHightestDepth());
          
          1 person found this helpful
          • 2. Re: getNextHighestDepth
            relaxatraja Level 5

            Create an empty movieclip between those buttons you want to keep up using layers. and load the swf inside the empty movieclip.

            1 person found this helpful
            • 3. Re: getNextHighestDepth
              sbusig Level 1

              I have tried both of the options detailed below (at least to the best of my ability), and for some reason it is still not what I am expecting.

               

              For the method outlined by relaxatraja I utilized a button placed inside a blank movie clip that was place with:

               

              this.createEmptyMovieClip("containerBtn",this.getNextHighestDepth());
              containerBtn.attachMovie("galerMC","galerMC_mc",containerBtn_mc.getNextHighestDepth());

               

              I can only get the external SWF to load using this code from within the button:

               

              on(release){
              loadMovieNum("galer.swf",1);
              }

               

              When I tried using a movie contianer like jfweber explained it would not load the external SWF.

               

              It seems there should be a simpler way to do this that I am just missing.

               

              Here is the code for external SWF.

               

              import mx.transitions.Tween;
              import mx.transitions.easing.Strong;

              this.createEmptyMovieClip("container2_mc",this.getNextHighestDepth());
              container2_mc._x = 0;
              container2_mc._y = 72;
              this.createEmptyMovieClip("container1_mc",this.getNextHighestDepth());
              container1_mc._x = 0;
              container1_mc._y = 72;
              this.createEmptyMovieClip("buttons_mc",this.getNextHighestDepth());
              this.attachMovie("loader","loader_mc",this.getNextHighestDepth());
              loader_mc._x = 589;
              loader_mc._y = 445;
              this.createEmptyMovieClip("text_mc",this.getNextHighestDepth());
              this.createEmptyMovieClip("imageframe_mc",this.getNextHighestDepth());

              var myMCL:MovieClipLoader = new MovieClipLoader();
              var myListener:Object = new Object();
              myMCL.addListener(myListener);

              myListener.onLoadProgress = function(target,bytesLoaded,bytesTotal) {
              loader_mc._alpha = 100;
              var pct = Math.round(bytesLoaded/bytesTotal*100)
              loader_mc.bar_mc._xscale = pct;
              }

              myListener.onLoadComplete = function(target) {
              loader_mc._alpha = 0;
              fadeIn();
              }


              buttons_mc.attachMovie("prev","prev_mc",buttons_mc.getNextHighestDepth());
              buttons_mc.attachMovie("next","next_mc",buttons_mc.getNextHighestDepth());
              buttons_mc.next_mc._x = 1056;
              buttons_mc.next_mc._y = 445;
              buttons_mc.prev_mc._x = 216;
              buttons_mc.prev_mc._y = 445;

              text_mc.attachMovie("projectText","projectText_mc",text_mc.getNextHighestDepth());
              text_mc.projectText_mc._x = 10;
              text_mc.projectText_mc._y = 235;

              imageframe_mc.attachMovie("squares","squares_mc",imageframe_mc.getNextHighestDepth());
              imageframe_mc.squares_mc._x = 13;
              imageframe_mc.squares_mc._y = 802;


              var numPics:Number = 5;
              var picArray:Array = new Array();
              var currentElement:Number = 0;
              var currentContainer:MovieClip = container1_mc;

              for (i=0;i < numPics;i++) {
              var location:String = "images/galer/galer_0" + (i+1) + ".jpg";
              picArray.push(location);
              }

              myMCL.loadClip(picArray[currentElement],container1_mc);

              buttons_mc.next_mc.onRelease = function() {
              if (currentContainer == container1_mc) {
                currentContainer = container2_mc;
                }
              else
              {
                currentContainer = container1_mc;
                }

              currentContainer._alpha = 0;
              container1_mc.swapDepths(container2_mc);
              if (currentElement < picArray.length-1) {
              currentElement++;
              }
              else
              {
                currentElement = 0;
              }
              myMCL.loadClip(picArray[currentElement],currentContainer);
              }

              buttons_mc.prev_mc.onRelease = function() {
              if (currentContainer == container1_mc) {
                currentContainer = container2_mc;
                }
              else
              {
                currentContainer = container1_mc;
                }

              currentContainer._alpha = 0;
              container1_mc.swapDepths(container2_mc);
              if (currentElement > 0) {
              currentElement--;
              }
              else
              {
                currentElement = picArray.length-1;
              }
              myMCL.loadClip(picArray[currentElement],currentContainer);
              }

               

              function fadeIn() {
              new Tween(currentContainer,"_alpha",Strong.easeOut,0,100,36,false);
              }

               

              Just looking for a way to keep my buttons above this imported SWF when placed into a main SWF using the loadMovieNum.

               

              Thanks for the previous input and thanks in advance for any help.

              • 4. Re: getNextHighestDepth
                sbusig Level 1

                The problem seems to be when I am targeting the blank MC for the external SWF.

                 

                If I do this:

                 

                this.createEmptyMovieClip("containerProj",this.getNextHighestDepth());
                this.createEmptyMovieClip("containerBtn",this.getNextHighestDepth());
                containerBtn.attachMovie("galerMC","galerMC_mc",containerBtn_mc.getNextHighestDepth());
                containerProj.loadMovie("galer.swf");

                 

                No prolem. The button is on top of the external SWF but it has no code to it.

                 

                Once I change to the following, nothing happens:

                 

                ////for the main movie

                 

                this.createEmptyMovieClip("containerProj",this.getNextHighestDepth());
                this.createEmptyMovieClip("containerBtn",this.getNextHighestDepth());
                containerBtn.attachMovie("galerMC","galerMC_mc",containerBtn_mc.getNextHighestDepth());

                 

                ////for the button

                 

                on(release){
                loadMovie("galer.swf","containerProj");
                }

                 

                Steve

                • 5. Re: getNextHighestDepth
                  jfweber Level 2

                  try the following code:

                   

                  var container      = this.createEmptyMovieClip("containerProj", this.getNextHighestDepth());
                  var containerBtn = this.createEmptyMovieClip("containerBtn", this.getNextHighestDepth());
                  
                  containerBtn.attachMovie("galerMC", "galerMC_mc", containerBtn.getNextHighestDepth());
                  containerBtn.container      = container;
                  
                  containerBtn.onRelease = function()
                  {
                       this.container.loadMovie("galer.swf");
                  };