Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Unload a movie when the next movie loads

Explorer ,
Dec 01, 2017 Dec 01, 2017

I have a main swf (2017XmasParty.swf) that I've placed the following code in frame 1.  That is all I have in my main swf timeline.

var swf1:MovieClip;

var loader1:Loader = new Loader();

var defaultSWF1:URLRequest = new URLRequest("Board.swf");

loader1.load(defaultSWF1);

addChild(loader1);

In Board.swf I've placed the same code on the Actions layer, frame 1400 which is the last frame of my timeline.  Of course I changed the swf file name to my next swf that I want to load and play after Board.swf.  This works great with the exception that the previous movie is lopping and plays simultaneously with the next swf.

I am fairly new to animate and actionscript and I've been searching for a solution but everything I read is to click on something to control the actions.  I have 11 swf files that I want to play one after the other and loop.  Each file has the above script to load the next with the last one reloading the first.

I need to know how to make them unload after they play and the next one loads.  I'm under a deadline and would greatly appreciate some advice!

Thank you!

TOPICS
ActionScript
470
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2017 Dec 01, 2017

in the last frame of Board, put:

dispatchEvent(new Event('endE'));

in your xmasParty, use:

var swfA=["Board.swf","nextswf.swf",etc];

var index:int=0;

var loader1:Loader = new Loader();

addChild(loader1);

loader1.contentLoaderInfo.addEventListener(Event.COMPLETE,completeF);

nextF(null);

function completeF(e:Event):void{

MovieClip(loader1.content).addEventListener("endE",nextF);

}

function nextF(e:Event):void{

if(index<swfA.length){

loader1.load(new URLRequest(swfA[index]));

index++;

}

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 01, 2017 Dec 01, 2017

You are my hero!!!!!!!  That worked and I'm going to make my 5:00 deadline!  Thank you for your quick reply!!!!! 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2017 Dec 01, 2017

you're welcome.

(p.s when using the adobe forums, please mark helpful/correct responses, if there are any.)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 01, 2017 Dec 01, 2017

I copied the swf files to my local hardrive (main and every swf it loads) but when I play it from my local harddrive it doesn't play the entire movie. Any ideas?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 02, 2017 Dec 02, 2017

I inserted my main movie into powerpoint and when I play the show it plays the first swf but the second ends after a few seconds and advances to the next movie.  Why does it not play the entire movie before advancing to the next one?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 02, 2017 Dec 02, 2017
LATEST

i don't use powerpoint so i can't answer that.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines