A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11303 Flash Movies | 7 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: Nitin Tikhe
» Title: Cart
» Description: This Animation Tut is a fun and useful for kids below 15 years. Watch the Flag, Doors, Stick and Horse movements.
» More by Nitin Tikhe


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

Featured Site

» Posted in the Flash Kit Links section
» Title: Banana Swimwear
» Description: This is a banana swim wear interactive catalog we designed and animated in Flash


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

» Make flash video player for broadcasting live streaming video / TV on website
» How to convert the project file of Flash Demo Builder 2.0 into FLV file
» FLV to PSP for Mac - How to convert YouTube video to PSP on mac
» How to Convert FLV to MP4 for Playback on iPod
» how to download and convert youtube video to AVI with Leawo Free FLV converter
» Flash Multi-player Game Tutorial - TicTacToe
» How to make Flash elearning tutorials with screen recorder?
» Fader API:Slideshow with MovieClips on stage
» How to convert MS PPT file into an FLV File
» Unknown Tag: Title10
Random Tutorial | Add Site

Network Design Manager
The Computer Merchant, Ltd
US-VA-Hampton

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 8
«prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ... next»

Getting it to stop and play its parent

Our loading movie will need to respond to load and enterFrame movie clip events. In the load event we will carry out some initialisation and in the enterFrame event we will check to see how our loading is going.

At this point it is probably useful to create a test bed movie to see how we are doing. This may be done with your original file or do a "Save As..." and name it something like "test-bed.fla". We will put the preloader movie on a layer named loader and place it only in the first frame. Create another layer that contains a large image (as we have done in the image layer below) and have it appear in frames 2 and 3. Also make a actions layer for assorted ActionScript and give that a keyframe in frame 3. Put a stop() command in that frame.

If you preview your test file (Ctrl+Enter), you should only see your image. Your preloader will just appear to be skipped.

Now close your test window and go back to your development windows. Go to frame 1 and select your loader movie. In the "Actions – Movie Clip" window, make sure you are in Expert Mode.

The first code to add will make the parent movie (the movie that we are loading) stop and play automatically. Let's add that code:

onClipEvent (load) {
    _parent.stop(); } onClipEvent (enterFrame) {     if (_parent.getBytesLoaded() >= _parent.getBytesTotal()) {           _parent.play();     } }

First, the loader stops the parent from playing, then every frame it checks to see how the download is going. If it has loaded completely, the parent movie is allowed to play.

If you preview this, you won't see any difference unless you Show Streaming (Ctrl+Enter in the preview window). When you stream the content however, the parent movie will stop and wait for the whole file to load before continuing on.

For a better test, add a large sound file to the stage. Add a large sound sample to your library (if it is too small, your sound won't have the chance to stream properly for this test). Create another layer named "sound" and add a keyframe to frame 2. Now make your sound stream by adding it to your sound layer at frame 2, ensuring that you have enough frames to fully play your sound. Finally, drag your stop script and your image to display after your sound has finished streaming.

When you preview this with Show Streaming on, your loader will loop its animation until the whole file is loaded, then the movie will continue playing to the end. If you go back and remove the code from your loader movie in frame 1, you should see the loader briefly flash on the stage, then the play head stops until enough sound is loaded to play the first part of the sound. As the file continues to load, your sound will stream until it completes playing then stop again while the image finishes loading.

Here's our Flash MX test file: test-bed.fla (1.7Mb). (It's big 'cos it includes the sound and image files - uncompressed!)

Save your file at this point.

«prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ... 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