1 Reply Latest reply on Jul 26, 2009 7:17 PM by kglad

    How to control an externally loaded SWF with actionscript

    lightwavemac Level 1

      This is a two part question and I'm fairly new to flash. I'm working on an flash movie and the interface is a small town (simiar to "doritos.com" and "comcasttown.com") if you reference both the doritos and comcast sites their little movie runs smoothly. I have several elements in the town. For example, one of the elements is an airplane hangar. When you rollover the hanger, I created a movie, the doors open and an airplane flies out of the hangar. I have several little movies throughout the interactive such as this. I created the hangar animation as a seperate swf file. In my main movie I created a button, on rollover it loads the hangar swf into an empty movieclip. When I publish and view the swf it plays slow and choppy. First, is it possible to write actionscript to load the external swf ,but it stops on the first frame of the animation and when you rollover it continues to play.  To put it all in a nutshell, I want to create several buttons throughout the movie with loadmovie functions, once the swf movies are loaded I want them to stop on the first frame of the animation and when you rollover loaded swf movie I want it to continue to play the animation. Should actionscript be applied to the swf movies first and preloaded into the main movie. And what will make the movies run smoothly once it's published and viewed in a browser.  Also if this makes a difference, I created the animations in after effects, exported them as FLVs imported them into flash and exported them as swf. Again it runs really slow and choppy. Am I taking the right approach?  I know this is alot of information, but any help would be greatly appreciated. Below is the script I used for the button.

       


      on (rollOver) {loadMovie("movies/solarpanel.swf", "solarload");

       


      Thanks

        • 1. Re: How to control an externally loaded SWF with actionscript
          kglad Adobe Community Professional & MVP

          1.  export a swf from after effects.

           

          2.  add a stop() to the first frame of your swfs so they don't start playing while they're loading.

           

          3.  apply mouse handlers to your target movieclips and use the play() method to start your swfs playing when rolled-over:

           

          target1mc.onRollOver=function(){

          this.play();

          }

           

          //and if you want them to stop when rolled-out:

           

          target1mc.onRollOut=function(){

          this.stop();

          }