Copy link to clipboard
Copied
I have a shell Flash that pulls in a swf file. When you hit the next button, it pulls in the next swf file. I numbered the swf files so they're 1.swf, 2.swf, etc. Everything works fine except theirs this blinking in between removing the old swf and bringing in the new. Right now I'm having them load into an existing moveClip called "clipsMC". I'm guessing that there's a split second where the old swf is removed and the new one loads. I need to have them run smoothly together though, so some type of listener to make sure the new one is loaded before removing the old one? Here's the part of the code I have for bringing it in:
function loadSwf()
{
clipNum = clipVar + ".swf"; // creates the name of the swf file... works
var url:URLRequest = new URLRequest(clipNum);
removeSWF();
myLoader.load(url);
clipsMC.addChild(myLoader);
}
function removeSWF():void
{
if (clipsMC.numChildren != 1)
{
myLoader.unloadAndStop();
clipsMC.removeChild(myLoader);
}
}
If you are using the Loader class, then you use the contentLoaderInfo property. The Help documentation should provide enough info in its use. Use of it would be pretty much along the lines of....
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, processLoadedContent);
where processLoadedContent is replaced by the name of whatever function you create as an event handler.
You could also use just one Loader object if you reparent the content of the Loader to a Sprite or Movielcip. You cou
...Copy link to clipboard
Copied
Oh and I can't share the fla unfortunately. It's security sensitive for a client.
Copy link to clipboard
Copied
If you are using the same Loader then you will have to change that. You need to have more than one so that you can have it where the first doesn't unload until the second is fully loaded.
As far as a listener goes, the Loader class has a contentLoaderInfo property which is essentially a LoaderInfo object which you can use to know when loading is complete.
Copy link to clipboard
Copied
Do you have any links or further information on how to implement the LoaderInfo object?
Copy link to clipboard
Copied
If you are using the Loader class, then you use the contentLoaderInfo property. The Help documentation should provide enough info in its use. Use of it would be pretty much along the lines of....
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, processLoadedContent);
where processLoadedContent is replaced by the name of whatever function you create as an event handler.
You could also use just one Loader object if you reparent the content of the Loader to a Sprite or Movielcip. You could keep the Loader invisible so that it only acts as a loading mechanism and not a displayed object.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now