Hi folks…
Ohh man i need help… Im a newbi, but still i have spend the last 6 hours to make a new preloader work in a flash template which has it own preloader.
Im not talking about the preloader for the site, but for loading the external swf in between. The buttons/menu are loaded via xml. And when you click on a button, it loads a external swf and this is where the preloader works.
Here is the preloader for the site:
onEnterFrame=function(){
top=_root.yukle.getBytesTotal();
yukle=_root.yukle.getBytesLoaded();
yuzde=Math.round(yukle/top*100);
bar._xscale=yuzde;
kutu=""+yuzde;
if(yuzde==100){
_visible=false;
}else{
_visible=true;
}
}
So it seems simpel, it just loads and after load it clear it self.
The next code here is for a cool preloader i got from flashden. But it is made so that, after the preloader has loaded, it will play the frames afterwards. I just want it as the above preloader, so it just loads the external swf.
Here is the code for the new preloader:
stop();
// Function for fading out objects
function fadeOut(){
// Reduce opacity
this._alpha-=5;
// Check to see if the clip has been faded out all the way, if so remove the script
if(this._alpha<=0){
// Set opacity all the way down
this._alpha=0;
// Set the visible to false
this._visible=false;
// Play next frame
play();
// Kill the enterframe script
this.onEnterFrame=null;
}
}
// Start the preloading
this.onEnterFrame=function(){
// Variable for how much is downloaded
dataLoaded=this.getBytesLoaded();
// Variable for the total file size
totalData=this.getBytesTotal();
// Variable that calculates the percentage downloaded
percentData=Math.round(100/totalData*dataLoaded);
// Animate the preloader. The preloader clip itself it 100px wide
preloader_mc.gotoAndPlay(percentData);
// Update the text field with the percentage downloaded
preloader_mc.percent1_mc.percent_txt.text=percentData+"%";
preloader_mc.percent2_mc.percent_txt.text=percentData+"%";
// Check to see if the movie is downloaded
if(percentData>=100){
// Play to the next frame
preloader_mc.gotoAndStop(100);
// Fade out the preloader and the text field
preloader_mc.onEnterFrame=fadeOut;
// Get rid of this enterframe script
this.onEnterFrame=null;
}
}
I really hope someone can help me with this. Im going crazy :hair:
Regards Hrbi