Pingvin
02-17-2004, 03:17 AM
Hello,
What I'm trying to do is load external mcs to my stage. I want to have a percentage bar showing how much is loaded.
here is what I've got:
// First the loader function, what works just fine:
function load_jpg_or_swf(targetMC, jpgURL) {
_root.holder.mtClip.loadMovie(jpgURL);
attachMovie("loader", "loadMC", 1000);
loadMC.loadtarget = _root.holder.mtClip;
loadMC.onEnterFrame = is_loaded_results;
loadMC._x = 0;
loadMC._y = 0;
}
// Then the function that is supposed to grow my percentage bar, doesn't work. I have a mc named projektiLoadBar on my stage. The script just loads the new mc, but the percentage bar doesn't grow.
function is_loaded_results() {
loading = _root.holder.mtClip.getBytesLoaded();
total = _root.holder.mtClip.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
per = int(percent);
_root.projektiLoadBar._width = per;
}
// And the following could also be in a button.. I have a button called b3, again this works fine..
b3.onRelease = function() {
yourJPGurl = "ruusutorppa.swf";
load_jpg_or_swf(mtClip, yourJPGurl);
};
I would really appreciate help with this one. If you have ready examles I would be happy to go through them.
Antti Karttunen
What I'm trying to do is load external mcs to my stage. I want to have a percentage bar showing how much is loaded.
here is what I've got:
// First the loader function, what works just fine:
function load_jpg_or_swf(targetMC, jpgURL) {
_root.holder.mtClip.loadMovie(jpgURL);
attachMovie("loader", "loadMC", 1000);
loadMC.loadtarget = _root.holder.mtClip;
loadMC.onEnterFrame = is_loaded_results;
loadMC._x = 0;
loadMC._y = 0;
}
// Then the function that is supposed to grow my percentage bar, doesn't work. I have a mc named projektiLoadBar on my stage. The script just loads the new mc, but the percentage bar doesn't grow.
function is_loaded_results() {
loading = _root.holder.mtClip.getBytesLoaded();
total = _root.holder.mtClip.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
per = int(percent);
_root.projektiLoadBar._width = per;
}
// And the following could also be in a button.. I have a button called b3, again this works fine..
b3.onRelease = function() {
yourJPGurl = "ruusutorppa.swf";
load_jpg_or_swf(mtClip, yourJPGurl);
};
I would really appreciate help with this one. If you have ready examles I would be happy to go through them.
Antti Karttunen