msg1 {
ghopper[+],
posted: 03.04.03 3p•-,
top [^]
}
this is a nice class, although I did have some problems with the onload handler.
This is my code:
interface_mc and the others don't start to play though. They are still stuck on frame 1 ( i've put a stop action on frame 1). I've tried using gotoAndPlay(2) - still didn't work though.
What I've ended up doing was to tell the main timeline to start playing :
and on frame 2-4 I had to put the commands to tell the others movies to play.
How can I get the first onLoad handler to work though ?
Thanks,
Adrian
P.S. i think Que should be written as Queue, but who cares ;)
msg2 {
rob_kn[+],
posted: 03.09.03 1p•-,
top [^]
}
scoping is your prob
should work now...
greatz rob
msg3 {
Mradose[+],
posted: 03.10.03 5a•-,
top [^]
}
This is a greet loader, I've got numerous projects on that involve loading up dozens of assets and this has saven me a considerable amount of time. However I cannot seem to load txt files and XML files correctly. I've tried it out and it seems to load them into the _$container but does not reload them into the target swf. Im not sure if it is supposded to work with these but i dont see why it shouldn't.
Hope you can help
msg4 {
juststeve[+],
posted: 03.12.03 5a•-,
top [^]
}
I'm in the middle of a project that could really benefit from this class but before I dive into implementation I hoping for some clarification on the ItemData function. It's depending on getBtyesLoaded(), right? But if the movie's compressed doesn't this become non-reliable? Reading ASDGv2 - p.659....getBytesLoaded() for a swf file with a post-compression size of 2,000 bytes might return, say, 10,000 bytes.
Wouldn't that throw off the whole 'is loaded' logic?
msg5 {
Funkatron[+],
posted: 03.12.03 4p•03.14.03 2p,
top [^]
}
Mradose: You need to use an XML object instead of an mc
que = new LoadQue();
myXML=new XML();
que.addItem("http://www.foo.com/foo.xml", myXML);
que.onLoad = function(){ trace("XML file loaded"); };
que.start();
edit: I also seem to have a few problems with it...it doesn't seem to load the second xml file I add. Also, in the $preloadNext function, shouldn't it use $loadItem instead of load??
msg6 {
Kenny Bunch[+],
posted: 03.18.03 12p•-,
top [^]
}
there seems to be a few issues that people are having. i'll look in to everything. i've just been working nonstop on this project and haven't had a time to look at any issues.
msg7 {
Kenny Bunch[+],
posted: 03.18.03 1p•-,
top [^]
}
here is an example of loading multiple xml files into multiple containers...
var myQue, xml1, xml2, xml3;
xml1 = new XML();
xml2 = new XML();
xml3 = new XML();
msg8 {
Funkatron[+],
posted: 03.19.03 4p•-,
top [^]
}
it still doesn't work cause the way it loads isn't correct.
It loads into a LoadVars object, then calls for the url to be loaded again. So, in essence, it does load everything, but it is keeping track of the loadvars object and not the actual object you want to load to
msg9 {
Kenny Bunch[+],
posted: 03.20.03 7a•-,
top [^]
}
Whoops. I'm sorry. I have been using a different version than is posted. I'll post my new one.
msg10 {
Kenny Bunch[+],
posted: 03.20.03 7a•-,
top [^]
}
updated
msg11 {
Funkatron[+],
posted: 03.21.03 9a•-,
top [^]
}
ooooohhh...poifect..
gonna try ut tonight
msg12 {
rob_kn[+],
posted: 03.23.03 8a•-,
top [^]
}
great work kenny,
i just tested it with swf, jpg, xml, loadvars, works perfectly.
btw. nice coding style :)
greatz rob
msg13 {
max.grafx[+],
posted: 04.02.03 8a•-,
top [^]
}
hello,
this code is amazing, so amazing that i don't get it.
i got it to work fine with loading xml, *.txt, jpg.
i have this project going that greats a whole interface from xml and code, from the xml a object gets his place on the scene (place 1, 2 and 3). it's build up with a for loop, in the for loop it goes to the preloader and after loading it has to have it's place wich he got from the xml file.
my question = how do i send some more variables with the script that is use to preload stuff?
i hope you understand where i'm getting at.
thanx in advance,
Max
msg14 {
max.grafx[+],
posted: 04.02.03 12p•-,
top [^]
}
i already got around fixing my last problem.
but as i already said i don't quit get how the code works, so my question is how do i implement a visual preloader?
max
msg15 {
solrac[+],
posted: 04.26.03 8p•-,
top [^]
}
I've done a visual preloader. Here is my code:
//FRAME 1
//-------
#include "loadQue.as"
loader = function (theURL, theMC, theName) {
delete que;
stop();
loadGUI_mc.gotoAndPlay("start");
que = new LoadQue();
for (i=0; i<theURL.length; i++) {
que.addItem(theURL[i], eval(theMC[i]), theName[i]);
}
que.onItemData = function(iPercent, sID) {
_root.loadGUI_mc.item = "Loading "+sID;
_root.loadGUI_mc.percent = int(iPercent)+"%";
_root.loadGUI_mc.fillerbar_mc.gotoAndStop(int(iPercent));
};
que.onTotalData = function(iPercent) {
_root.loadGUI_mc.item = "TOTAL percent loaded: "+iPercent+"%";
};
que.onLoad = function() {
_root.loadGUI_mc.item = "Loading is complete";
_root.loadGUI_mc.gotoAndPlay("done");
for (i=0; i<theURL.length; i++) {
_root.newload[i] = _global.theURL[i];
}
_global.theURL = [""];
_global.theMC = [""];
_global.theName = [""];
};
que.start();
};
//------------------------
//FRAME 2 (or any frame in any loaded movie)
//-----------------------
_global.theURL = ["content.swf", "profile.jpg", "background.jpg"];
_global.theMC = [content_mc, profile_mc, background_mc];
_global.theName = ["Main Content", "Profile Image", "Background Image"];
_root.loader(_global.theURL, _global.theMC, _global.theName);
stop();
//-------------------------
//Place a movieclip on Frame 1 called loadGUI_mc. Inside that
//Place two textfields, one with variable "item"
//One with variable "percent", and another
//movieclip called "fillerbar_mc". Inside "fillerbar_mc" Make
//a shape tween animation from frame 1 to 100 of a rectangle growing
//(basic loading bar)
//----------------------------------------------------------------------
Now I got my own question... I can't figure out how to load text variables into a movieclip. How would I do this? Standard urlencoded text file separated by ampersands. I want to load the variables into an object or movieclip. How do I do this???
Thanks,
-Carlos-
msg16 {
twist[+],
posted: 05.02.03 2p•-,
top [^]
}
This code is sweet, but...
I can't get it to work properly with a component I'm creating. Is there something I'm missing with the scope to get this to work properly?
Any help appeciated...
twist
msg17 {
helloniklas[+],
posted: 06.06.03 9a•-,
top [^]
}
This all works great, apart from the onItemData! It only does a few callbacks, and only on like 25%, 50%, 75% 100%. Even if I try and change the callback interval it doesn't change. So it want be a nice visual preloader with 25% steps!
Any comments?
msg18 {
vbuzzi[+],
posted: 06.17.03 5a•-,
top [^]
}
Great work.
Thank you very mutch
Vittore
msg19 {
King of punk[+],
posted: 08.16.03 9a•-,
top [^]
}
Thank you very much for this class that save one of my customer project
msg20 {
thiefoflight[+],
posted: 03.16.04 8p•-,
top [^]
}
First of, I want to thank you for providing this extremely useful class. It is just the snippet of code that I can use for almost all of the projects that I will ever encounter.
One thing I wanted to figure out is how to get the total size of all the items being loaded so that I can create one preloader for the entire que, rather than creating a preloader for each individual item. I see that the loading percentage updates on the onItemData event, but that is only for that individual item. I know that through your class you are preloading each item sequentially. Is there any way to tell it to preload all at the same time so that I can perform a getTotalBytes and getBytesLoaded for the whole que? Thanks.
msg21 {
Kenny Bunch[+],
posted: 03.17.04 6a•-,
top [^]
}
You can use onTotalData. It will give you the percentage based on the total items. This is different than actual byte percentage. For instance, if you have 2 items, when one is loaded you will receive 50% loaded. You can't find percentage of all the items up front without pinging them (basically starting a download). Hope that helps.
I've actually restructured all of this into smaller classes that are more focused on specific tasks. When I get a chance I'll update them for everyone. I'm bad, just have alot of things I'm workin on.
The biggest edit I've made is in removing the onTotalData functions and callbacks, and attempting to calculate the total byte size of the elements being preloaded rather than calculating TotalData by the number of elements in the array.
The main edits are made to the $onItemData handler, where I have created a totalPercentBytes variable and method to calculate and broadcast the total amount loaded, and to the LoadQue.start handler, where I create a custom Object and LoadVars to load the element in, check its size, and immediately delete it, keeping the data of its size for the actual LoadQue. This method allows for an accurate single preloader that calculates percentage completed in regular intervals.
HOWEVER, IT SOMETIMES DOES NOT LOAD THINGS! THIS IS WHERE I NEED HELP FROM ALL OF YOU. Most of the time, it works fine, but sometimes I feel like it just bypasses the data passed from my objects and fails to load the whole que. Also, I usually have to set the interval to run at at least 100, or else it skips some elements. Any help from you gurus would be greatly appreciated, especially from you, Kenny, since you are the one with most expertise on this. To see it in action (and perhaps see the bug in action too) click here: http://www.jcharvet.net
Let's get this working so that we have the best possible preloader available for all of our benefit. I have faith in you guys!
msg25 {
Lamplighter[+],
posted: 10.23.06 3p•-,
top [^]
}
Is there a way to stop an active download?
msg26 {
jgraup[+],
posted: 11.30.06 4p•-,
top [^]
}