1 Reply Latest reply on Jun 9, 2006 2:30 PM by Wolf_van_Ween

    controlling swfs from other swfs.

    bB_
      hi there. the site i've designed has a background layer, a navigation panel layer(menu) and the content is loaded as separate swf files on levels behind the navigation panel. to allow for seamless unload of the content i want to control the transition from the navigation panel layer.

      eg. When the user clicks on "Story" button, the navi panel layer communicates with the content layer (eg. Welcome page), tells it to play from frames 50-60 and then unload. After this, the desired content layer (in this case "Story") is loaded into, say layer 5.

      how do i go about coding this in actionscript? i'm slightly bamboozled by the actual script for it and i'd really appreciate some direction.
        • 1. Re: controlling swfs from other swfs.
          Wolf_van_Ween Level 1
          If you load your movieClips into levels, you simply use those levels to direct them, e.g. _level5.gotoAndPlay(50)
          You can't tell a movieClip to play from frame 50 to 60 and then stop. I mean you could, but judging from the question you ask I guess you don't want to get into so much complexity.
          You tell the clip to play, and the clip should know itself when to stop. If you want to be a bit more flexible, you can set a variable in the clip and check it at certain keyframes via actionscript:
          in the controlling clip:
          _level5.stopFrame = 60;
          _level5.gotoAndPlay(50);
          And in the controlled clip in possible stop frames:
          if(stopFrame == _currentframe) { stop(); }
          You could enable this for every frame via an onEnterFrame event handler.
          Of course you need to tell the controlling clip to continue in some way, e.g. by sending it to another frame....

          This of course is very linear and old style programming, not object oriented.

          It would be better not to load into levels, but into named movieClips at certain depths. This allows you to use the movieClipLoader class, and program all that event-driven.