Control External File with a Button on External Timeline

Control External File with a Button on External Timeline

Flash CS4 ActionScript 3.0 Tutorial

How to Control External Timeline with a Button in External Flash File

External movie timeline control can come from a button on the main stage or a button in an external swf file. In this example we have a button located on the stage of the external file timeline that controls the playhead of the external timeline.

An external file is one that is introduced to the main timeline using the Loader class. The external .swf file is located in a Swf folder that resides next to the main .swf file timelline.

Tutorial Elements

The external .fla file and .swf file are placed in a folder named Swf. The external files should be named External.swf and External.fla. The Swf folder should be at the same level as the host swf file (Main.swf).

A button on the stage of the external file timeline named external_btn.

Step Fifteen

Dissecting the Code

The first two lines of the code at Step Three introduce a loader named loadExt and grab the External.swf file in the Swf folder. The addChild line places the external file on the stage.

At Step Thirteen, the code stops the timeline of the external file at frame one. The next section adds an event listener to the external_btn. Once it hears a mouse click, the function onAdvance is run. The onAdvance function sends the timeline to frame two of the External.swf file.