CHECKING FRAME LOAD IN FLASH



You can use the ifFrameLoaded action to make sure that the download of movie contents to the local computer has completed before you trigger an ActionScript statement or series of statements. Developers frequently use the ifFrameLoaded action to keep the movie from beginning until the browser has downloaded the entire movie contents. The syntax for the ifFrameLoaded action is

ifFrameLoaded(scene, frame) {
statement;};


The scene argument is optional. Use it to specify the scene whose download you want to check. Use the frame argument to specify the frame number or frame label that Flash must load before Flash executes the statement. Use the statement argument to specify the statement or series of statements to execute.

You can create a preloader with the ifFrameLoaded action. A preloader is a short animation that plays while the rest of the animation is loading. For example, you can create a preloader that reads, Please Wait... Movie Loading. The preloader stays on the screen until the specified frames have downloaded completely. After the specified frames have downloaded, the rest of the animation starts. When using a preloader, place the preloader in the first frames on the Timeline. You can use the gotoAndPlay command and create a loop that executes until the necessary frames have loaded.

You can also use the _framesloaded property with an if statement to make sure the download of movie contents to the local computer has completed before you trigger an ActionScript statement or series of statements.

Follow the steps to check frame load:

1) Click the frame, button, or movie clip to which you want to add ActionScript.

This example uses a frame.

2) Click Window from menu and then Actions to open the Actions panel.

3) Click Basic Actions to open the Basic Actions category.

4) Double-click If Frame Is Loaded to select the ifFrameLoaded action.

5) Click drop-down button to select a scene.

6) Click drop-down button to select a frame type.

7) Click drop-down button to select a frame.

8) Double-click Go To.

9) Click drop-down button to select a scene.

10) Click drop-down button to select a frame type.

11) Click drop-down button to select a frame.

12) Your movie plays after the specified number of frames have loaded.

13) Click Control from menu and then Test Movie to move to the test environment.

14) Test your movie.