this is great... the spacebar is LAAAAAME!
this is the code for some loader script thingamabobber...
//animate progress bar
function updateProgress() {
//switch statement changes display based upon the value of 'phase' passed to it,
//so that user can see the rate of completion. The 'label' attribute is the
//text that is displayed on the progressbar.
switch (phase) {
case 1:
progressbar1.label = "Phase 1: Creating Characters ";
progressbar1.setProgress(1, 5); // 1 out of 5 steps complete
break;
case 2:
progressbar1.label = "Phase 2: Creating Cities ";
progressbar1.setProgress(2, 5);// 2 out of 5 steps complete
break;
case 3:
progressbar1.label = "Phase 3: Creating Trees ";
progressbar1.setProgress(3, 5);//3 out of 5 steps complete
break;
case 4:
progressbar1.label = "Phase 4: Completing Generation ";
progressbar1.setProgress(4, 5);//4 out of 5 steps complete
break;
case 5:
progressbar1.label = "Phase 5: Compressing ";
progressbar1.setProgress(5, 5);//all 5 steps complete
break;
default:
//clears the setInterval calls to updateProgressBar
clearInterval(id);
progressbar1.setVisible(false);
//the loader1 movieclip runs "behind the scenes", waiting for the
//updateProgress function to finish; then we know that all
//the info has been downloaded successfully and we can proceed
//to load the image into the loader1 mc.
loader1.addEventListener("updateProgress", this);
//locate the image to load
loader1.contentPath = "balloons.jpg";
break;
}
phase++; //progress to the next phase
}
//this is called with the progressbar component as the instance,
//to allow us to tailor its look-n-feel
function setStyles(instance) {
instance.setStyle("color", "white");
instance.setStyle("fontFamily", "Arial");
instance.setStyle("fontSize", 14);
instance.setStyle("fontStyle", "italic");
instance.setStyle("textIndent", 10);
}
//show the progressbar running
function startExample(showIndeterminate:Boolean) {
if (showIndeterminate) {
phase = 6;
//call updateProgress() every 12000 milliseconds
id = setInterval(updateProgress, 12000);
progressbar1.indeterminate = true;
progressbar1.label = "";
} else {
phase = 1;
//call updateProgress() every 2000 milliseconds
id = setInterval(updateProgress, 2000);
progressbar1.label = "Initializing ";
}
}
//set the parameters and styling of the progress bar
progressbar1.mode = "manual";
progressbar1.labelPlacement = "top";
progressbar1.setSize(300,30); //resize
progressbar1.move(150,210); //relocate
setStyles(progressbar1); //finally apply the styles
//initiate the progress bar at phase 1
startExample(false);
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment