Connect
To Top

FLASH OPEN SOURCE: Preloader driven animation

I know it has been way, way too long since I have uploaded any new open source to any of my sites. I used to have a better balance between design and production/actionscripting but lately have been concentrating almost entirely on design and I wanted to get things back in balance. I have started work again on the new version of my portfolio site, have been sprucing up this blog and have been coding again.

I started back in with this simple file that uses a preloader to control the progress of a timeline animation. In this case the couch animation is broken up into eight parts and each part will only play once the corresponding percentage has been loaded. If the whole file loads right away like in this case the animation will play straight through. The best way to see it in action is download the file, publish it and run the ‘simulate download’ under the View option.

The heart of the script looks like this –

p = Math.round((_root.getBytesLoaded()/tkb)*100);
// This calculates the amount of the file that has loaded in bytes and concerts it to a percentage.

// This uses the range calculated what part of the animation should be played.
if (p >= 90) {
this.couch.targetnum = 8;
} else if (p <= 89 and p >= 80) {
this.couch.targetnum = 7;

and so on. This runs in a loop until the file is loaded and it goes on to play the transition to the image.

Download for Mac | Download for PC

You must be logged in to post a comment Login

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

More in Digital culture