A clever skip intro button

Clever? How? Our skip intro button will only show itself when the entire site intro has loaded. This is because our site intro is not wasting time; it is entertaining while loading important resources that will be used in the remainder of the site by exporting the shared resources as you may see in this image:

The method is to drop a button on to a layer in the main timeline and add your code to load the appropriate file when it is clicked. Ours looked like this:

on (press) {
        loadMovie("main.swf", 0);
}

Convert your button to a movie clip (F8) and give it an appropriate name.

Now add the following code to it:

onClipEvent (enterFrame)
{
        if (_parent.getBytesLoaded() == _parent.getBytesTotal()) {
                this._visible = true;
                 } else {
                 this._visible = false;
                }
}

This code will make the button visible the instant the entire file has loaded; otherwise the button will be invisible. With this version, the file may be skipped as soon as possible. See the sample files intro.fla (160kb) and main.fla (127kb) for how this may be implemented.

With a few changes, you can make it show only if everything has loaded in the first frame (so that the skip intro only shows if the intro has already been viewed), forcing the intro to be viewed at least once:

onClipEvent (enterFrame) {
         if (_parent._currentframe == 1) {
                 if (_parent.getBytesLoaded() == _parent.getBytesTotal()) {
                         this._visible = true;
                        } else {
                         this._visible = false;
                         }
                 }
}

Automatic skip build

Finally, we may use these ideas to skip animations that have already played once for the viewer. This is great if we have managed to avoid building an intro by animating in screen elements as we were streaming in content, but are now stuck with that animation every time the viewer returns.

This piece of code checks to see if the file has already been loaded. If not, then we should let our loading animations play (this could be things like logos sliding in, menus building, whatever takes your fancy). But if the file has fully loaded already this means that your visitor has probably already been entertained by your media callisthenics and would just like to use your site. In this case you can just jump forwards to an appropriate frame where the visitor may get down to business. (If you animations are really cool, you can still add in a button that says "play intro"!)

Add a layer and name it "actions". Keyframe frames 1 and 2. Add this code on frame 1 of the actions layer.

if (getBytesLoaded() == getBytesTotal()) {
        gotoAndPlay("skip build");
}

Now add a layer and name it "labels". Keyframe frame 1. Label this frame "start". Also add a keyframe where you would like to skip forward to if the file has already been fully loaded. Label this frame "skip build".

All done. Easy.

Conclusion

The actual approach that we used in our intro for the Western Australian Museum's "Western Australia: Land and People" exhibition involved a mixture of all of the methods we have discussed here. The intro was used as a last resort when resources became too large to be included in our main SWF file.

In the intro we streamed the smallest content first (mainly logos) and animated them in while waiting for the large map image to load. When that was available, the map was animated in, providing the background image for the online virtual exhibition.

Throughout this, we are constantly checking the download progress and as soon as the intro is fully down, we display the "skip intro" button. Clicking on the button doesn't load our main SWF file, but instead jumps to the end of our intro (straight to our unfolding map animation) providing an appropriate segue to the virtual exhibition proper.

For more information about our loader, check out the "Yet Another Flash MX Loader" tutorial elsewhere on this site.

About the authors

The Glasson Murray Group, Pty. Ltd. creates and presents high quality and engaging content for delivery across a range of media. They designed and developed the virtual exhibition in conjunction with the Western Australian Museum, producing a truly compelling and unparalleled presentation.

http://www.gmg.com.au/

Copyright

Materials are copyrighted and are protected by worldwide copyright laws and treaty provisions. Copyright law in Australia is contained in the Copyright Act 1968 (Cth) and in decisions of courts, with further amendments in the Copyright Amendment (Moral Rights) Act 2000. They may not be copied, reproduced, modified, published, uploaded, posted, transmitted, or distributed in any way, without GMG's prior written permission. Except as expressly provided herein, GMG and its suppliers do not grant any express or implied right to you under any patents, copyrights, trademarks, or trade secret information. Other rights may be granted to you by GMG in writing or incorporated elsewhere in the Materials.

© 2003 Glasson Murray Group Pty Ltd (ACN 098 651 542), Western Australia. All rights reserved.