Trying to Use Milosav's example3 without loading from a button - HELP
Hi,
Millsav, I am using you third exmple of creating a preloader to load in all my top level movies.
I'm not loading from a button, and when I but in the code in the 1st frame of my movie, dataLoaded and dataTotal =0. They never get bigger so the test condition doesn't work.
First I tried to put it into the OnEnterFrame method, but it didn't work either. Then I decided to create an emptyMC on my main movie called "LoaderMC" which will do all the loading OnClipEvent (load), but that didn't work either.
For purposes of simplicity, here is the code I put in the 1st frame of my main.swf. Not sure if this needs to be in onEnterFrame. I'm even using your movie1. Should I be able to pass the name of the container create, ex dancers to dataCheck?
//DancersMC does get created and the debugger says the URL for this MC is "Movie1_P3.swf
//however, dataLoaded and dataTotal stay at 0.
stop ();
//load in all the movies.
this.createEmptyMovieClip("dancers",100);
loadMovie("Movie1_P3.swf","dancers");
dancers._x = 50;
dancers._y = 150 ;
loaderInterval=setInterval(dataCheck ,100);
//function to check amount of data recieved
function dataCheck(){
//number of bytes loaded of "holder.swf"
dataLoaded= dancers.getBytesLoaded();
//number of bytes Total of "holder.swf"
dataTotal= dancers.getBytesTotal();
trace (dataTotal);
if(dataLoaded>=dataTotal && dataLoaded>0)
{
//play "holder.swf" which is now loaded into Movie Clip instance "holder.swf"
trace ("i am in");
dancers.gotoAndPlay(2); //
clearInterval(loaderInterval);
}
}
thanks in advance,
Lisa
Wierd but I got it to work with the following code
Hi,
I got it to work with a LoaderMC on the main.swf. I was having problem calling using play (); and ended up changing it to gotoAndPlay (2); I wonder if that is because I have an MC on frame 2. I also have to put this.intromc.play (); on frame 2 of my external .swf to get the introMC to play.
The code on the LoaderMC is:
Right now there is no animation. I wanted to get the basics to work first. I'll add an animation later. This is an example of loading only one external .swf, but will be calling others in the future. Also, I am going to try to pass an argument to dataCheck for better streamling.
onClipEvent (load) {
//load in all the movies.
_root.createEmptyMovieClip("dancers",100);
loadMovie("dancers2.swf", _root.dancers);
_root.dancers._x = 50;
_root.dancers._y = 150 ;
loaderInterval=setInterval(dataCheck ,100);
//function to check amount of data recieved
function dataCheck(){
//number of bytes loaded of "holder.swf"
dataLoaded= _root.dancers.getBytesLoaded();
//number of bytes Total of "holder.swf"
dataTotal=_root.dancers.getBytesTotal();
if(dataLoaded>=dataTotal && dataLoaded>0)
{ //make loader Bar invisible
// _level4._visible=false;
//play "holder.swf" which is now loaded into Movie Clip instance "holder.swf"
_root.dancers.gotoAndPlay (2);
//reset movieLoading flag to false
//movieLoading=false;
//stop the loaderInterval
clearInterval(loaderInterval);
}
//scale the progress bar.
//_level4.theBar._xscale=(dataLoaded/dataTotal)*100;
}
}
So much more to do, I'll be posting again when problems arise. I hope this thread continues.
Lisa
Passing an arguement to dataCheck
Hi,
Its all about syntax. SetInterval (funtion, interval, arg...) and it works.
I was calling setInterval like : setInterval (dataCheck (dancers), 100);
This should be setInterval (dataCheck, 100, dancers);
cool.
lisa
fading buttons in a movie clip
Hi Milosav,
Hope you are still around, I was talking to you about this problem I was having with incorporating fade out roll over buttons in a movie clip. I still have not been able to figure out what is wrong. I have put your trace code into one and am now getting an error message(now that I have pulled the menu out of the main file and am just woking on it in its own file).
Please have a look at it(or anyone else that is knowledgable).
http://www.thefoundationsite.com/men...st/menubar.zip
Thanks much, I appreciate any help you can give, i would really like to understand this as I would like to use it in one of my sites if I can figure it out.
Thanks!
cf.