-
[F8] Quick help with code
I have this attached file
www.thinking-tank.com/files/preloader.fla
I am trying to make this preloader mc named "loader" to work with the MCL action. Can some one shed some light into how I can make this work ?
Thanks
-
-
It would be quite helpful if you described what exactly doesn't work. But guessing from your script, I found some possible issues:
wrong variable name here. use loaded instead of loader. also, to reference the "loader" instance, you must target it correctly:
Code:
mclL.onLoadProgress = function(target,loaded,total) {
_root.loader.percent.text = Math.round((loaded/total) * 100) + "%";
}
mclL.onLoadInit = function() {
_root.loader._visible = false;
_root.loader.percent.text = "";
}
b1.onRelease = function() {
_root.loader._visible = true;
mcl.loadClip("new_movie.swf",holder);
}
b2.onRelease = function() {
_root.loader._visible = true;
mcl.loadClip("swf2.swf",holder);
}
-
I tried that code but to no avail. I cannot even get the percent to work.
-
this code works fine for me:
Code:
var mcl:MovieClipLoader = new MovieClipLoader();
var mclL:Object = new Object();
mclL.onLoadProgress = function(target, loaded, total)
{
_root.loader.percent.text = Math.round((loaded / total) * 100) + "%";
};
mclL.onLoadInit = function()
{
_root.loader._visible = false;
_root.loader.percent.text = "";
};
mcl.addListener(mclL);
mcl.loadClip("new_movie.swf", holder);
b1.onRelease = function()
{
_root.loader._visible = true;
_root.mcl.loadClip("new_movie.swf", _root.holder);
};
b2.onRelease = function()
{
_root.loader._visible = true;
_root.mcl.loadClip("swf2.swf", _root.holder);
};
it's all about the targetting...
-
I got it working. Thanks !
I uploaded the new version to the same file name as above.
How can I make it so that the red bar goes all the way across the screen as it loads.For instance, using a var amount and then using the xscale to stretch the bar across the entire screen.
Thanks again for all your help !
-
this one:
myVar = Math.round((loaded / total) * 100);
gparis
-
but how do I apply that to a bar within the loader clip ? If you take a quick look at the attached file you will see what I mean.
Thanks
-
Well, exactly as you fisrt said, using:
myVar = Math.round((loaded / total) * 100);
_root.bar._xscale = myVar;
gparis
-
but how do I plug that into the code I currently have ? Just add it to the bottom ?
-
mclL.onLoadProgress = function(target, loaded, total) {
loader.percent.text = Math.round((loaded/total) * 100) + "%";
myVar = Math.round((loaded/total)*100);
loader.bar._xscale = myVar;
};
gparis
-
I will try that.
Thank you very much for your input !
-
One last thing. What code can I add to the following so that when each button is pressed, the mc loaded before will remain visible so the preload loads on top. Then once the new mc is loaded the old one goes away.
var mcl:MovieClipLoader = new MovieClipLoader();
var mclL:Object = new Object();
mclL.onLoadProgress = function(target,loaded,total) {
loader.percent.text = Math.round((loaded/total) * 100) + "%";
myVar = Math.round((loaded/total)*100);
loader.bar._xscale = myVar;
}
mclL.onLoadInit = function() {
loader._visible = false;
loader.percent.text = "";
}
mcl.addListener(mclL)
mcl.loadClip("new_movie.swf",holder);
b1.onRelease = function() {
loader._visible = true;
mcl.loadClip("new_movie.swf",holder);
}
b2.onRelease = function() {
loader._visible = true;
mcl.loadClip("swf2.swf",holder);
}
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|