Skip navigation
Currently Being Moderated

loading 2 swf files into a main swf

Dec 30, 2010 9:28 PM



I have created a main movie which I would like to load 2 external swf's in succession.I would like that when the 1st swf is finished playing, it should be replaced by the second swf. I would also like that there be no blank screen in between the unloading of the 1st swf and loading up of the 2nd swf, if this is possible.


I have very little knowledge of AS, so I would appreciate that the person who responds to this question should be as explicit as possible.


Many thanks.

  • Currently Being Moderated
    Dec 31, 2010 8:13 AM   in reply to ericcan3183

    This is unrealistic to expect that someone will provide a complete implementation for this application. It is more efficient to split your questions into smaller problems you need to solve so you can gradually move from one step to another.


    Show what you have done so far and where you got stuck.

    Mark as:
  • Currently Being Moderated
    Jan 1, 2011 10:59 AM   in reply to ericcan3183

    What constitutes loaded swf "finished playing"? If the loaded swf is a one timeline application and "finished playing" is when it gets to its last frame - you can add ENTER_FRAME event listener  to it and when it gets to the last frame - get rid of it.


    If the loaded swf is a more complex application or doesn't have a timeline - you will need to implement a mechanism INSIDE loaded swf that will notify that it finished playing. The best way would be to dispatch an event from it. In this case the main container will listen to this event at act upon receiving it.


    As for the transition, you are dealing with Internet and, thus, with a lot of unpredictable latencies. Because of it if you need a smooth transition - the only way would be to preload next swf and display it when first one is finished playing.

    Mark as:
  • Currently Being Moderated
    Jan 2, 2011 9:02 AM   in reply to ericcan3183

    Something like this:


    var my_Loader:Loader = new Loader();
    my_Loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
    my_Loader.load(new URLRequest("1-6.swf"));
    var currentSWF:MovieClip;
    function onLoadComplete(e:Event):void {
         my_Loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onLoadComplete);
         currentSWF = MovieClip(;
         currentSWF.addEventListener(Event.ENTER_FRAME, onEnterFrame);
    function onEnterFrame(e:Event):void 
         if (currentSWF.currentFrame == currentSWF.totalFrames) {
              currentSWF.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
              // if you want to get rid of it altogether
              currentSWF = null;
    Mark as:
  • Currently Being Moderated
    Jan 2, 2011 6:32 PM   in reply to ericcan3183

    Oh, your external swfs are written in AS2.


    AS2 and AS3 are totally incompatible. Do you have control of external swfs?

    Mark as:
  • Currently Being Moderated
    Jan 2, 2011 8:55 PM   in reply to ericcan3183

    This is not an error but warning that doesn't affect anything. I suggest you turn off the warnings.

    Mark as:
  • Currently Being Moderated
    Jan 2, 2011 10:00 PM   in reply to ericcan3183

    The same way you load the first one. You can create another Loader instance or an Array that will holds loaders or their content.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points