Jump to content
Search Community

loading first swf and play other swfs loading in background

Hassonya test
Moderator Tag

Recommended Posts

There are several ways to accomplish this. Here's one:

 

LoaderMax.activate([sWFLoader]);

var queue:LoaderMax = LoaderMax.parse(["2.swf","3.swf","4.swf","5.swf","6.swf","7.swf","8.swf","9.swf"], {maxConnections:1}, {autoPlay:false});
queue.prepend( new SWFLoader("1.swf", {container:this, autoPlay:true}) );
queue.load();

Link to comment
Share on other sites

When you say "later", are you saying you want to let 1.swf play all of its frames and then you want to play the other swfs? If so, you should either edit your child swf(s) so that it dispatches an Event when completes (plays its last frame) that you listen for in the parent and then take action accordingly. Or use an ENTER_FRAME to compare the currentFrame to its totalFrames to know when it hit its last frame.

Link to comment
Share on other sites

Hi,

 

I have tried the following code but getting errors:

 

The whole Code I have written on my Actions Layer is:

 

LoaderMax.activate([sWFLoader]);

 

var queue:LoaderMax = LoaderMax.parse(["Clock.swf","Logo.swf","MyWebsite.swf"], {maxConnections:1}, {autoPlay:false});

queue.prepend( new SWFLoader("1.swf", {container:this, autoPlay:true}) );

queue.load();

 

I am getting the following error:

 

1046: Type was not found or was not a compile-time constant: LoaderMax.

1120: Access of undefined property LoaderMax.

1120: Access of undefined property SWFLoader.

1120: Access of undefined property LoaderMax.

1180: Call to a possibly undefined method SWFLoader.

 

Please help me.

Link to comment
Share on other sites

Hi,

 

I tried the following code. But only first SWF file (Logo.swf)is playing well then stops. How can I play the other two SWF files one after one? Please help.

 

The following is the whole code on form:

 

import com.greensock.loading.*;

import com.greensock.events.*;

 

var urls:Array = ["swfs/Logo.swf","swfs/Clock.swf","swfs/MyWebsite.swf"];

 

var curLoader:SWFLoader;

var curSWF:MovieClip;

 

playSWF(urls[0]);

 

function playSWF(url:String):void {

if (curLoader != null) {

curSWF = null;

curLoader.dispose(true);

removeEventListener(Event.ENTER_FRAME, checkFrame);

}

curLoader = new SWFLoader(url, {container:this, onComplete:completeHandler});

curLoader.load();

}

 

function completeHandler(event:LoaderEvent):void {

curSWF = curLoader.rawContent;

addEventListener(Event.ENTER_FRAME, checkFrame, false, 0, true);

}

 

function checkFrame(event:Event):void {

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

var index:int = urls.indexOf(curLoader.url) + 1;

if (index < urls.length) {

playSWF(urls[index]);

} else {

trace("done with all swfs");

}

}

}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...