Loader in Flash MX Tutorial. Have you ever wondered how i made my loader for my flash site? Well here i'll show you how it's donned. 1. Start up Flash MX and create a new document, rename the layer 1 to "loader". Then make a frame for the loading bar(with no fill!) NOTE: it must go from left-right, or else it'll look funny. When you're donned with the frame, select the fill tool and a color for it, this will be the color of the loading bar. Fill within the frame you made, select the fill with the selection tool. 2. In the actions field, insert this code: onClipEvent(enterFrame){ //Gets the info about the file. total=_root.getBytesTotal(); totalkb=Math.round(total/1000); loaded=_root.getBytesLoaded(); loadedkb=Math.round(loaded/1000);
//Calculates percent. percent=Math.round(loadedkb/(totalkb/100)); _root.text1=percent + "% LOADED"
//Controlls our progressbar. this._xscale=percent;
//Calculates kilobytes.
_root.text2=loadedkb + " kb of " +totalkb +" kb LOADED"; //Checks if it's donned loading.
if(loaded==total){_root.gotoAndStop(2);} }
Now make 2 text boxes under the progressbar, in the Var: field write text1 in the one right under the progressbar, and text2 in the one under the other text field. NOTE: Don't forget to change it to Dynamic Text. Now try the progress bar.
|