Copy link to clipboard
Copied
Hello,
I want to create loading screen and i want to check if all my XML file ( class10.xml, class11a.xml & class11s.xml ) finish loading go to frame 2. How can i do that ?!
Regards,
if you assign COMPLETE event listeners to the loaders, you can keep a count of how many have completed loading and use that to trigger going to frame 2
Copy link to clipboard
Copied
if you assign COMPLETE event listeners to the loaders, you can keep a count of how many have completed loading and use that to trigger going to frame 2
Copy link to clipboard
Copied
Thanks for the tip, So there no class in as3 to load multiple file and check if all of them complete...?!
Copy link to clipboard
Copied
No there are no core class doing that but it's quite easy to do it sequentially or to create a simple class that does that. That could go something like that:
1. pass an array of paths to your custom loader class:
var loader:MultipleLoader = new MultipleLoader(["path1.xml", "path2.xml"])
loader.addEventListener(Event.COMPLETE, moveOn);
loader.load();
Then in your MultipleLoader class you can do:
public function load():void
{
loadNextXML();
}
private function loadNextXML(e:Event = null):void
{
if(!myxmlarray.length)
{
dispatchEvent(e);
return;
}
var path:String = myxmlarray.shift();
//code to load each xml from the array that was passed and stored in myxmlarray Array
//you register Event.COMPLETE with loadNextXML method so you can cycle until the array is empty
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now