[color green]Just to let you know that I'm relocating my server as of today, and for a period of three to four weeks, none of the links to my files on this site will work.
If you need a file from me which is linked from this site then please just email me details of the relevant link and I will send the relevant file(s) to you.
After I've relocated the server and all the files within it I shall endeavour to update all links in Tek-Tips.[/color]
I've just submitted this post for DorXBasS in the forum and thought I might as well set it up here, as there doesn't seem to be any:
the demo of this can be found at:
www.pinkzeppelin.com/FAQ/250-532/preloader.html
the fla can be found at:
www.pinkzeppelin.com/FAQ/250-532//preloader.zip
OK: What I mentioned in the forum was that you should paste the frames of your movie to start at the "site" label in the example I've made. The following actions are within the controller movie-clip:
[color red]
/:loaded = _root.getBytesLoaded();
[color green]1
[/color]
/:total = _root.getBytesTotal();
[color green]2
[/color]
if (Number (/:loaded) == Number (/:total)) {
[color green]3
[/color]
tellTarget ("_root") {
gotoAndStop ("site");
}
}
/ercentage2 = (Math.floor(/:loaded /1000))+"K of "+(Math.floor(/:total / 1000))+"K loaded";
1>>>finds out the number of bytes loaded in the movie so far and assigns the variable '/:loaded' to that value. (note: the presence of "/:" before a variable name means that it is sending this variable to the main timeline)
2>>>finds the toal byte-size of the movie and assigns the variable '/:total' to that value.
3>>>This is the part that tells the maintimeline ("_root") to go to the frame "site" (ie: where I said you should make the starting point of the rest of your movie) when the two aforementioned variables are equal (ie: when your movie is fully loaded)
4>>>This line defines the variable "/ercentage2" which is the variable assigned to the dynamic textbox on the main stage. The actionscript "Math.floor" basically rounds the number down to the nearest integer. I guess you'll be able to figure out the rest of this line for yourself, pretty easy stuff.
5>>>Sets the scale of the loader bar. The loader bar is a movie-clip with instance name "bar" hence "_root.bar" .(If someone reading this has used flash 4 but not 5 too much, then _root is the equivalent of _level0 in flash4, adn basically defines the main timeline.). So this line is basically telling the loader bar to stretch to the defined percentage loaded (which takes the form of the equation (loaded/total)*100 .
6>>>Final line. If you've dragged your loader bar onto the main stage and tested the movie, you'll notice that you get a flicker, where the bar starts at 100% then drops to 0% when the scripting kicks in. In order to prevent this, I drag the bar off the main stage to where it can't be seen in the final movie. This action repositions the loader bar, and because it is the final action, it ensures that no flicker occurs.
There are three objects on the main stage: the loader mc; the control mc (which contains the above actions which loop until the main timeline is sent to "sent"); and the dynamic text box which displays the calculated amount loaded (in K-bytes) against the total movie-Kbyte-size.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.