Flash Script – Advanced Preloader

Share this article


Download the sample files here.

1. Set up three layers in a new movie. Name the first one "loader", the second "actions", and the third "picture".

2. Create two text boxes. Go into the Type pallet, and place it as Dynamic Text with Variable names "totalbytes" and no options checked. Give the other variable the name "loaded bytes".

3. Place this text field in the loader layer.

4. In the picture layer, import a large picture of your choice. Make it 5 frames long, and make the last frame a key frame. Then, delelt the first four frames, leaving just the fifth. Name the fifth frame "end frame". Insert the stop(); action into this layer.

5. Now go to the actions layer, and create two key frames.

6. In the first key frame, insert the action:

loadedbytes = getBytesLoaded()/1000;  

totalbytes = getBytesTotal()/1000;  

if (loadedbytes == totalbytes)  

{  

gotoAndPlay ("endframe");  

}

7. In the second key frame, insert the action:

gotoAndPlay (1); 

8. Press Ctrl+Enter twice on your keyboard. It’s done! The preloader is complete.

Georgina LaidlawGeorgina Laidlaw
View Author

Georgina has more than fifteen years' experience writing and editing for web, print and voice. With a background in marketing and a passion for words, the time Georgina spent with companies like Sausage Software and sitepoint.com cemented her lasting interest in the media, persuasion, and communications culture.

Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week