16.5. Hiding a Progress Bar When Content Has Loaded
Problem
You want to determine when content has completed loading so that you can tell Flash to hide the progress bar.
Solution
If you are using the Flash 8 Cookbook ProgressBar
, set the autoHide
parameter to true
.
Otherwise, if you are using the Macromedia v2 ProgressBar
, add a listener object, and when the complete( ) method is called, have Flash set the ProgressBar
instance’s visible
property to false
.
Alternatively, if you are using a custom load indicator as discussed at the end of Recipe 16.4, add a listener object to the MovieClipLoader
object, and when the onLoadInit( ) method is called, have Flash set the movie clip and/or text field’s _visible
property to false
.
Discussion
Typically, when content has completed loading, you will want to hide the ProgressBar
or other graphical indicator that you have used to display the load progress to the user. If you are using the Flash 8 Cookbook ProgressBar
, all you need to do is set the autoHide
parameter to true
. Then, when the percent loaded has reached 100%, the instance will automatically hide.
If you are using the Macromedia v2 ProgressBar
, your job is a little more complex. In order to accomplish this task, you’ll need to use a little bit of ActionScript. But you needn’t worry: the ActionScript is fairly short and simple.
If you want to hide a ProgressBar
component instance after the content has loaded, complete the following steps:
Create an event listener object. As with the other types ...
Get Flash 8 Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.