I would like my preloader to load various phrases using loadText.text =’’; based on the percentage loaded…
The phrases should be locked to the percentage of loading. For example:
0-24% “loading frogs”
25-49% “loading paddles”
50-74% “loading trucks”
75-99% “loading good times”
100% “complete”
My code is below:
I was trying to use something like this…
Code:
if(percentage.text => '0%'){
loadText.text = 'Loading Juicy Overflows';
existing code:
Code:
stop();
//
//file to be loaded:
var loadFile:String = “flash/flav_o_rama.swf”;
//list of MCs on the stage and order they should be tweened in:
var blend_sound:Sound = new Sound(this);
blend_sound.attachSound(“blend”);
var slot_sound:Sound = new Sound(this);
slot_sound.attachSound(“slot”);
var mcList:Array = new Array(‘blender’, ‘plusSign’, ‘slotMachine’);
//
import mx.transitions.Tween;
import mx.transitions.easing.;
//
var isloaded:Boolean = false;
var animationDone:Boolean = false;
var listCount:Number = 0;
var text:Number = 0;
percentage.text = ‘0%’;
//
//hide stuff for later fade in:
for (var i:Number = 0; i<mcList.length; i++) {
this[mcList]._alpha = 0;
}
//loadText
if(percentage.text => ‘0%’){
loadText.text = ‘Loading Juicy Overflows’;
} else if(percentage.text => ‘25%’){
loadText.text = ‘Loading Luck’;
}
//
tweenIn();
function tweenIn():Void {
if(mcList[listCount] == ‘blender’){
//loadText.text = ‘Loading Juicy Overflows’;
blend_sound.start();
} else if(mcList[listCount] == ‘slotMachine’){
//loadText.text = ‘Loading Luck’;
slot_sound.start();
}
this[mcList[listCount]]._alpha = 100;
new Tween(this[mcList[listCount]], '_xscale', Bounce.easeOut, 0, 100, 12, false);
var twn:Tween = new Tween(this[mcList[listCount]], '_yscale', Bounce.easeOut, 0, 100, 12, false);
twn.onMotionFinished = function():Void {
listCount++;
if (mcList[listCount]) {
tweenIn();
} else {
animationDone = true;
}
};
}
//
this.onEnterFrame = function():Void {
if (isloaded && animationDone) {
for (var i:Number = 0; i<mcList.length; i++) {
this[mcList*]._alpha -= 8;
}
percentage._alpha = loadText._alpha -= 8;
if (percentage._alpha<0) {
loadContainer.play();
for (var i:Number = 0; i<mcList.length; i++) {
this[mcList*].swapDepths(this.getNextHighestDepth());
this[mcList*].removeMovieClip();
}
delete this.onEnterFrame;
}
}
};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//LOADING OF MOVIE:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//we’ll load the movie into “loadloadContainer”:
this.createEmptyMovieClip(‘loadContainer’, this.getNextHighestDepth());
var loadListener:Object = new Object();
loadListener.onLoadComplete = function() {
//trace(“onLoadComplete called”);
};
loadListener.onLoadProgress = function(target:MovieClip, loadedBytes:Number, totalBytes:Number):Void {
percentage.text = Math.round(100*(loadedBytes/totalBytes))+"%";
};
loadListener.onLoadInit = function(target:MovieClip) {
percentage.text = ‘100%’;
loadText.text = ‘Loading Complete’;
isloaded = true;
//trace(“finished download”);
};
var movLoader:MovieClipLoader = new MovieClipLoader();
movLoader.loadClip(loadFile, loadContainer);
movLoader.addListener(loadListener);
[IMG]http://www.actionscript.org/forums/images/statusicon/user_online.gif[/IMG] [[IMG]http://www.actionscript.org/forums/images/buttons/report.gif[/IMG] [IMG]http://www.actionscript.org/forums/images/misc/progress.gif[/IMG] [URL="http://www.actionscript.org/forums/editpost.php3?do=editpost&p=582098"][IMG]http://www.actionscript.org/forums/images/buttons/edit.gif[/IMG] [URL="http://www.actionscript.org/forums/newreply.php3?do=newreply&p=582098"][IMG]http://www.actionscript.org/forums/images/buttons/quote.gif[/IMG] [URL="http://www.actionscript.org/forums/newreply.php3?do=newreply&p=582098"][IMG]http://www.actionscript.org/forums/images/buttons/multiquote_off.gif[/IMG] [URL="http://www.actionscript.org/forums/newreply.php3?do=newreply&p=582098"][IMG]http://www.actionscript.org/forums/images/buttons/quickreply.gif[/IMG]](http://www.actionscript.org/forums/report.php3?p=582098) shillin22
[View Public Profile](http://www.actionscript.org/forums/member.php3?u=47730)
[Send a private message to shillin22](http://www.actionscript.org/forums/private.php3?do=newpm&u=47730)
[Find More Posts by shillin22](http://www.actionscript.org/forums/search.php3?do=finduser&u=47730)
[Add shillin22 to Your Buddy List](http://www.actionscript.org/forums/profile.php3?do=addlist&userlist=buddy&u=47730)
[[IMG]http://www.actionscript.org/forums/images/buttons/reply.gif[/IMG]](http://www.actionscript.org/forums/newreply.php3?do=newreply&noquote=1&p=582098)
[CENTER] « Previous Thread | [URL=“http://www.actionscript.org/forums/showthread.php3?t=129073&goto=nextnewest”]Next Thread » [/CENTER]
var mqlimit = 0; vBulletin Message
[Cancel Changes](http://www.actionscript.org/forums/showthread.php3?t=129073#)
[[IMG]http://www.actionscript.org/forums/images/buttons/collapse_tcat.gif[/IMG]](http://www.actionscript.org/forums/showthread.php3?t=129073#top) Quick Reply The following errors occurred when this message was submitted
[Okay](http://www.actionscript.org/forums/showthread.php3?t=129073#)