A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11337 Flash Movies | 1 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: Bugra Ozden
» Title: Skatalog v9 - product catalog
» Description: Create your product catalog easly and publish on your website or Create your image gallery, documents list, portfolio. Fully XML Driven
» More by Bugra Ozden


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 5828 Flash Sites | 0 New Flash Links
What's New | Top 100 Flash Site

Featured Site

» Posted in the Flash Kit Links section
» Title: Creative DW Image Show PRO
» Description: Creative DW Image Show PRO is a Dreamweaver extension which enables the user to create multimedia presentations. It combines the features of the popular Creative DW Image Show with the ability to add professional text effects to slides (similar to After Effects). The product is very customizable: the user can choose the duration of the transition effects, the slide motion start and end position, zoom and panning type for both images and texts.


Random Links | Add your own Flash Related Links
Flash Tutorials 1280 Tutorials 7 New Tutorials Added!
What's New | Top100

» Make a Flash Slide Show Screen Saver
» Simple flash making tutorial for thanksgiving
» Create flash banner for website
» Create xml slideshow with free template
» How to Insert a Multilingual Subtitle Into Your Flash Video Studio
» How to Create Cool Halloween Slideshow
» Debugging flash using the Firebug console
» Create Flash Slideshow on Blogger
» FLASH TRICKS IN WEB ADVERTISING: FLASH BANNERS
» Unknown Tag: Title10
Random Tutorial | Add Site

Sr Instructional Designer D2L-Moodle,Clearance
WSI Nationwide, Inc.
US-NJ-Fort Monmouth

Justtechjobs.com Post A Job | Post A Resume


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Utilities

Categories Yet Another Flash MX Loader
Author: Tim Murray | Website: http://www.gmg.com.au |

 
Page 13
«prev ... 3 4 5 6 7 8 9 10 11 12 13 14 15 16 next»

Setting a maximum load rate

The last bit of code will limit the number of frames that we can leap in a single bound. All we have to do is keep track of what frame we handed back on our last function call, compare it to where we want to go now, and if it is too much of an advance then we clamp it to a maximum jump.

To achieve this, we will need an extra variable named lastFrame to store the last frame we showed. This is initialised to 1 which is the frame just before our loader animation starts. Here is the final loader code:

lastFrame = 1;
function loadedIndicatorFrame() {
    var newFrame = int((_parent.getBytesLoaded() / _parent.getBytesTotal()) * 65) + 2;
    if (newFrame - lastFrame > 4) {  //too far
          lastFrame += 4;
          loadedText = int(_parent.getBytesTotal() / 1024 * (lastFrame - 2) / 65) + "kb of " + int(_parent.getBytesTotal() / 1024) + "kb";
    } else if (newFrame - lastFrame > 0) {  //normal move
          lastFrame++;
          loadedText = int(_parent.getBytesLoaded() / 1024) + "kb of " + int(_parent.getBytesTotal() / 1024) + "kb";
    }
    return lastFrame;
}

Most of the code is the same, but I'll give it a quick run through anyway. Given that our frame rate for the Western Australian Museum project was set to 25 fps, we found that skipping 4 frames at a time gave us enough time to see the loader and still not be annoying if a movie was already downloaded. Just play with the values to get it right for your frame rate.

If we are skipping frames for a movie that has already been downloaded, then we want to fake our bytes loaded text so that it matches the current frame that we are showing. Our loadedText calculations are now based on lastFrame instead of getBytesLoaded.

Preview now (Ctrl+Enter) to see your loader animation play through once in a fast-forward style before continuing on with the parent movie. When streaming the preview, you should see your loader animation tick through according to your bandwidth settings until you hit the required percentage, then it will continue on playing the parent movie to the end.

If you find that you are creating large SWF files (such as for video) you might find that you need to update the Dynamic Text object more frequently than when you advance to the next frame of your loader. The code for this would be:

lastFrame = 1;
function loadedIndicatorFrame() {
    var newFrame = int((_parent.getBytesLoaded() / _parent.getBytesTotal()) * 65) + 2;
    if (newFrame - lastFrame > 4) {  //too far
        lastFrame += 4;
        loadedText = int(_parent.getBytesTotal() / 1024 * (lastFrame - 2) / 65) + "kb of " + int(_parent.getBytesTotal() / 1024) + "kb";
    } else if (newFrame - lastFrame > 0) {  //normal move
       lastFrame++;
        loadedText = int(_parent.getBytesLoaded() / 1024) + "kb of " + int(_parent.getBytesTotal() / 1024) + "kb";
    } else {  //update the text only
        loadedText = int(_parent.getBytesLoaded() / 1024) + "kb of " + int(_parent.getBytesTotal() / 1024) + "kb";
    }
    return lastFrame;
}

Now would be a good time to save this using Save As... so that you can give your loader a better name (choose "loader" again). It would also be good to get rid of any test images, sounds, and layers from your file. After tidying up the file, check the linkage on your loading movie in the Library for loader.fla by right-clicking on it and selecting the Linkage... option. It should look like this:

Save it, publish it, and were ready to rock and roll.

«prev ... 3 4 5 6 7 8 9 10 11 12 13 14 15 16 next»

» Level Advanced

Added: : 2003-12-08
Rating: 8.44 Votes: 169
Hits: 2530
» Author
Tim is a co-director of the Glasson Murray Group, providing quality graphic design, illustration, 3D visualisation, interactive environments, virtual reality, multimedia and website services.
» Download
Download the files used in this tutorial.
Download (1860 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments
 
   
 

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs