PDA

View Full Version : Using this code, how would you load multiple things?



garyzero
May 2nd, 2006, 01:04 PM
Or how would you have things load after the previous movie has loaded?


//Load Tools
// create event listener object for the loader
loadToolsListener = new Object();
// click event handler
loadToolsListener.complete = function ( eventObject )
{
toolsPreloader._visible = false;
}

// register the event listener
loadTools.addEventListener("complete", loadToolsListener);

mpelland
May 2nd, 2006, 01:20 PM
hmmmm well that isn't really used to create anything.. what it is doing is creating a listener that is listening for your loadTools to send a "complete" event. once that happens it triggers the function to hide the preloader.

not sure what you want to do.. but if you want it to run stuff when the loadTools sends that complete event then you add the code to load multiple things right under toolsPreloader._visible = false;

garyzero
May 2nd, 2006, 01:33 PM
Sorry, a better question is could I use the Loader component to load more than one swf at a time or structure it to load a sequence of swf's, one after another after the previous one has loaded?

I'm also wondering if that component can be used more than once and apply x and y coordinates in it to the movies it loads.

JoshuaJonah
May 2nd, 2006, 01:36 PM
Maybe you could make a function that is called by the loader and have that function load more than one movie:)?

B L U E
May 2nd, 2006, 01:45 PM
function startLoad(max:Number):Void {
function loadSeq() {
loadToolsListener = new Object();
// click event handler
loadToolsListener.complete = function ( eventObject )
{
if(count<=max) {
toolsPreloader._visible = false;
count++;
loadSeq();
}
}

// register the event listener
loadTools.addEventListener("complete", loadToolsListener);
}
}
probably a bad way of doing it, but try it :)

garyzero
May 2nd, 2006, 03:47 PM
Thanks for your help guys, I figured it out and got it working. I will just have to get a programmer to rewrite what I did a shorter way.

Take care,
Gary

JoshuaJonah
May 2nd, 2006, 03:50 PM
post it, we'll see what we can do:)