askurat1
02-13-2008, 06:17 AM
I need a little help converting this to Actionscript 3.0.I have done some of it so for but I need help on the rest.
Thanks in advance.
stop();
// Function for fading out objects
addEventListener(Event.
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
addEventListener(Event.ENTER_FRAME, currentProgress);
function currentProgress(e:Event):void{
// Variable for how much is downloaded
//var dataLoaded=this.getBytesLoaded();
// Variable for the total file size
//var totalData=this.getBytesTotal();
var bytestotal = stage.loaderInfo.bytesTotal;
var bytesloaded = stage.loaderInfo.bytesLoaded;
// Variable that calculates the percentage downloaded
var percentData = Math.round(bytesloaded/bytestotal)*100;
// 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;
}
}
Thanks in advance.
stop();
// Function for fading out objects
addEventListener(Event.
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
addEventListener(Event.ENTER_FRAME, currentProgress);
function currentProgress(e:Event):void{
// Variable for how much is downloaded
//var dataLoaded=this.getBytesLoaded();
// Variable for the total file size
//var totalData=this.getBytesTotal();
var bytestotal = stage.loaderInfo.bytesTotal;
var bytesloaded = stage.loaderInfo.bytesLoaded;
// Variable that calculates the percentage downloaded
var percentData = Math.round(bytesloaded/bytestotal)*100;
// 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;
}
}