3 Replies Latest reply on Oct 1, 2010 11:14 PM by kglad

    Movieclip depths AS3

    celebritymusic Level 1

      Hi

       

      I have a movieclip on the stage called "scroller"

       

      I also have some code which is sucking in external swfs from an array, and displaying and playing them consecutively.

       

      Problem is, the external swfs are covering part of my "scroller" swf, which I don't want to happen.

       

      How do I make the scroller swf stay on top all the time?  I've tried playing with layer heights, and child index settings, but I haven't nailed it.

       

      Here's my external swf code - thanks for taking a look - Shaun:

       


      // Array of external clips to use. Variable index refers to next clip to be displayed.
      var clips:Array = ["001/.swf", "002.swf"];
      var index:int = 0;

       

      // Stuff to load swf files
      var thisLoader:Loader = new Loader();
      thisLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, doneLoading);
      //loader.contentLoaderInfo.addEventListener(Event.COMPLETE, dataOnLoad);

       

      var thisMC:MovieClip = new MovieClip();
      stage.addChild(thisMC);            // Add empty MC initially so the nextClip function can be generic

       

      // Removes old MC and gets the next one, waiting until when it has initialized beore adding it to the stage
      function nextClip():void {
          thisLoader.load(new URLRequest(clips[index]));
      }

       

      // Tell AS that the loaded file is a movie clip and add it to the stage.
      function doneLoading(e:Event):void {

       

      stage.removeChild(thisMC);

       

      thisMC = MovieClip(thisLoader.content);

       

      thisLoader.unload();

       

      thisMC.addEventListener(Event.ENTER_FRAME, runOnce);

       

      stage.addChild(thisMC);

       

      fscommand("fullscreen", "true");

       

      thisMC.gotoAndPlay(1);

       

      }

       

      // When thisMC has finished, play the next clip.
      function runOnce(e:Event):void {

       

      if (thisMC.currentFrame == thisMC.totalFrames) {

       

      thisMC.removeEventListener(Event.ENTER_FRAME, runOnce);

       

      index = (index + 1)%(clips.length);

       

      nextClip();

       

      }

       

      }

       

      // Call the nextClip function initially to get the ball rolling
      nextClip();