MedVision ad

FLASH MX - loading page (1 Viewer)

SashatheMan

StudyforEver
Joined
Apr 25, 2004
Messages
5,656
Location
Queensland
Gender
Male
HSC
N/A
ok theres like a miillion loaders, one of the easiest ill try to tell you now .

1. Create another Scene which will hold yuor loader
2. In that Scene create 3 Key-frames one after the other. (yes all only 3)
3. Label the third Keyframe soemthing eg "FrameLabelOfyourThirdKeyframe"
4. type this code in the First keyframe
Code:
total = _root.getBytesTotal();
 loaded = _root.getBytesLoaded();
 if (loaded>=total) {
 gotoAndPlay("FrameLabelOfyourThirdKeyframe");}
code explanation:
Total and Loaded = variables
getBytesTotal() is a code that gets the total bytes of yuor movie
getBytedLoaded() is a code that gets the amount of bytes loaded so far.

5. in your second keyframe put this code
Code:
gotoAndPlay(1);
This is to create a loop , so while its loading it keeps going back to start.
6. Now in yuor third keyframe put a
Code:
stop();
On this (third) keyframe put a button that will appear as the movie has loaded which directs you to your Scene where yuor original movie is. You have to tell the button to go to that scene but i am shore u know that.



So basically what this does , is go from frame 1 to 2 and checks if the whole movie has loaded, if it has it goes to frame 3 , where it stops and there is a button that means it has loaded.

To have graphics in the loader just make More frames before the Frame that contains the main code and add animations.

i included a .FLA file so u can look at the code Its winzipped


if u need more help ask me.
 
Last edited:

felafel

Member
Joined
Mar 28, 2004
Messages
269
Location
North Shore
awesome - sasha i'll check it out

mednez, yeah there are heaps of tutorials for all FLASH PHOTOSHOP DREAMWEAVER etc. ey but haha they get a bit tedious sometimes
 

sladehk

le random
Joined
Jul 26, 2004
Messages
1,000
Gender
Undisclosed
HSC
2006
A good way to learn is through examples. Download some *.fla related to "Loading screen" and then fiddle around with it.
 

SashatheMan

StudyforEver
Joined
Apr 25, 2004
Messages
5,656
Location
Queensland
Gender
Male
HSC
N/A
do yuo knwo how to Test out the Preloader? cuase u cant just see it in action when viewing the movie from yuor computer, becuase nothing ever gets loaded.

When you test movie under Debug menu select the speed of yuor internet connection eg 56k (4.7KB/s) and then go to View > Show Streaming.

this will reenact the loading time it will take for a 56k connection user to download yuor movie.
 

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
felafel said:
oh cool

i guess making loaders which show the PERCENT loaded is a lot more difficult?
Simple math.

Code:
percent = (_root.getBytesLoaded() / _root.getBytesTotal())*100
 

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
If you don't know how to create a text field and set its text, I think you might want to start off with some more basic ActionScript tutorials before trying to make a preloader.
 

felafel

Member
Joined
Mar 28, 2004
Messages
269
Location
North Shore
*sigh*

yes i guess if i really want to use flash properly i should do all the tutorials

but thanks for the help!
 

SashatheMan

StudyforEver
Joined
Apr 25, 2004
Messages
5,656
Location
Queensland
Gender
Male
HSC
N/A
ok its easy too



just add these two lines of code in yuor keyframe where the other code is:
Code:
 percentage = getBytesLoaded() / getBytesTotal()* 100
NOTE: DONT USE LINE OF CODE ABOVE CUASE ITS NOT THE BEST , READ ON

EXplanation:
percentage = variable
the stuff on the right side of the = is basic math, which finds the percent of the bytesloaded divides it over totalbytes and times 100.

this will give you a percent but with lots of decimal points eg 46.458749857
to make it a whole number yuo should add code to make it round off. so the end code sound look like this
Code:
 percentage = math.round(getBytesLoaded() / getBytesTotal()* 100 )
make a dynamic text box where u want your percentage to appear in.
i called mine "TXTpercent"
then add this code in the keyframe with all the other load of code
Code:
_root.TXTpercent = percentage + "%"
explanation:
percentage = variable
the + is used to conbine two items
"%" is used just that, that symbol is diplayed.

explanation:
math.round() is a code that rounds of numbers to whole


i included a indated .fla file so u can look at the code
ps i also have another text box in the file that displays the kbs loaded.
pps ask me if u have any trouble
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top