Macromedia Flash 8 Bible Free Open Book

Macromedia Flash 8 Bible

Previous Page
Next Page

Managing Smooth Movie Download and Display

When Flash movies are played back over the Internet, they progressively download, meaning that the Flash Player plug-in shows as much of the movie as it can during download, even if the whole file has not been transferred to the user's system or browser cache. The benefit of this feature is that users start seeing content without having to wait for the entire movie to finish downloading.

Note 

Technically, a Flash movie file is not a streaming file format, but a progressive download file format, similar to an original Apple QuickTime 3 video movie. A progressive download can be viewed before the entire file has been received by the browser. Streaming file formats are never saved as actual files in the browser cache. You can't save a true streaming file, but you can typically save a shortcut or link to the file's location on the Web. Flash Communication Server video streams, for example, cannot be cached as a file on the user's system.

Nevertheless, progressive downloading has potential drawbacks. During download and playback, the movie may unexpectedly halt at arbitrary points on the timeline because a required portion of the movie has not yet downloaded. Worse yet, if you use several linked assets (that is, assets in the library that are set to export for ActionScript, such as components), by default the first frame of your Flash movie won't play until all of those assets have downloaded.

Thankfully, there's a solution. You can regulate the playback of the movie by using ActionScript code to prevent the movie from playing until a specified portion of it has downloaded. This technique is often referred to as preloading. A common preload sequence, or preloader, involves displaying only a short message, such as "Loading Please Wait," while the movie loads. Once the appropriate amount of the movie has been retrieved, the movie is allowed to play. ActionScript provides basic and advanced methods of producing a preloader. This section of the chapter shows you how to use the following three different internal actions (or methods) to check the download status of a Flash movie:

  • ifFrameLoaded(): This action has been around since Flash Player 3, and it enables you to check whether a specified frame label in the Flash movie has been downloaded by the plug-in. This is the simplest action to use to check a movie's download progress. If you are designing Flash Player 5 or later movies, this action is considered deprecated.

  • MovieClip._framesloaded and MovieClip._totalframes: Introduced with Flash Player 4, these properties can be checked on a Movie Clip timeline or the Main Movie timeline (Scene 1, Scene 2, and so on). _framesloaded returns the current number of frames that have downloaded into the plug-in, whereas _totalframes returns the number of frames that exist on the specified target timeline.

  • getBytesLoaded() and getBytesTotal(): These methods were introduced in Flash Player 5 ActionScript. The most accurate way to check the progress of a Flash movie download is to use these methods with other ActionScript code. You can use these methods for the following objects in ActionScript for Flash 6 movies: MovieClip (including loaded movies [.swf files] or JPEG images) and Sound objects that load MP3 files. You can also use these methods to check the download progress of PNG, GIF, and progressive JPEG images in Flash Player 8.

Note 

Flash Player 7 introduced a new method of monitoring the load progress: the MovieClipLoader class. The implementation of this class is used for external asset loading and is discussed later in this chapter.

In this edition of the book, we show you how to use the getBytesLoaded() and getBytesTotal() methods in ActionScript to check the download progress of movie assets.

Cross-Reference 

You can find our coverage of Flash Player 3 and 4 movie preloaders (as discussed in the Flash 5 Bible [Wiley, 2001]) on the book's Web site, www.flashsupport.com/archive.


Previous Page
Next Page
Index: [A][B][C][D][E][F][G][H][I][J][K][L][M][N][O][P][Q][R][S][T][U][V][W][X][Y][Z]


     Main Menu
Table of Contents
Back Cover
Macromedia Flash 8 Bible
Foreword
Preface
Part I: An Introduction to Flash Web Production
Part II: Mastering the Flash Environment
Part III: Creating Animation and Effects
Part IV: Integrating Media Files with Flash
Part V: Adding Basic Interactivity to Flash Movies
Part VI: Distributing Flash Movies
Part VII: Approaching ActionScript
Part VIII: Applying ActionScript
Chapter 28: Sharing and Loading Assets
Managing Smooth Movie Download and Display
Preloading a Flash Movie
Preloading a Flash Movie Containing Components
Loading Flash Movies
Loading Images into Flash Movies
Loading an Asset with the MovieClipLoader API
Loading MP3 Audio into Flash Movies
Loading a Flash Video into a Flash Movie
Displaying a Flash Video at Its Native Size
Using a Preloader for External Assets
Using the Loader and ProgressBar Components
Accessing Items in Shared Libraries
Summary
Chapter 29: Sending Data In and Out of Flash
Chapter 30: Applying HTML and Text Field Formatting
Chapter 31: Creating a Game in Flash
Chapter 32: Managing and Troubleshooting Flash Movies
Part IX: Integrating Components and Data-Binding
Part X: Expanding Flash
Part XI: Appendixes
Index
List of Figures
List of Tables
List of Listings
List of Sidebars


More Books
PHP Hacks
Processing Xml With Java - A Guide To Sax, Dom, Jdom, Jaxp, And Trax
The Koran (Holy Qur'an)
Macromedia Flash 8 Bible
Search Engine Optimization for Dummies
YouTube Traffic
PHP 5 for Dummies
Harry Potter and The Chamber of Secrets
Harry Potter and the Sorcerer's Stone
The Pilgrim's Progress
Wireless Hacks
Flash Hacks. 100 Industrial-Strength Tips & Tools
PayPal Hacks. 100 Industrial-Strength Tips and Tools
Amazon Hacks
Pdf Hacks
The Da Vinci Code
Google Hacks
The Holy Bible
Windows XP For Dummies
Harry Potter and the Half-Blood Prince
Seo Book
Upgrading and Repairing Networks
Macromedia Dreamweaver 8 UNLEASHED
Windows XP Annoyances
Windows XP Hacks
Microsoft Windows XP Power Toolkit
Teach Yourself MS Office In 24Hours
iPod & iTunes Missing Manual
PC Hacks 100 Industrial-Strength Tips and Tools
PC Overclocking, Optimization, and Tuning - 2th Edition
PC Hardware In A Nutshell 3rd Edition
PC Hardware in a Nutshell, 2nd Edition
Upgrading and Repairing PCs
Google for Dummies
MySQL Cookbook
Teach Yourself Macromedia Flash 8 In 24 Hours
PHP CookBook
Sams Teach Yourself JavaScript in 24 Hours
PHP5 Manual
Free Games Paper Airplanes
500 Juegos Gratis 500 Giochi Gratis 500 Jeux Gratuits 500 Jogos Gratis 500 Kostenlose Spiele