Jump to content
Search Community

Load SWF but do not instantiate it

mattwhituk test
Moderator Tag

Recommended Posts

Hi,

 

I am in the middle of a project which involves a main controller swf which loads in individual pages which are themselves swfs. Up until this point I have had the external pages loaded in one at a time as and when they are needed which has worked but can be very slow.

 

What I would like is to be able to load all of other pages in the background as the first one is playing so that it will be ready when the next pages are needed. LoaderMax has been fantastic for loading in my assets for the individual pages and I would love to use it for this also.

 

My problem is that all of the pages seem to be playing over each other when loaded in. I have tried the following:

 

var firstMC:MovieClip=new MovieClip();
var secondMC:MovieClip= new MovieClip();

var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler});
queue.append( new SWFLoader("page1.swf", {name:"firstClip", onComplete:completeFirst, container:firstMC, autoPlay:false}) );
queue.append( new SWFLoader("page2.swf", {name:"secondClip", onComplete:completeSecond, container:secondMC, autoPlay:false}) );

function completeFirst(event:LoaderEvent):void{
this.addChild(firstMC);
}

 

This works visually but unfortunately all of the timers and sounds from the other pages play.

 

I would be incredibly grateful if anyone could shed any light on how I could load in the pages without running them before they are called.

 

Matt

Link to comment
Share on other sites

I think there is a difference between autoPlay:false which will prevent the playhead from advancing and preventing scripts from executing on frame 1 of the loaded swf.

 

you can you put all your code in the loaded swfs in frame 1 in an init() function, and then call the init() function from the parent swf when you want that "page" to play.

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...