• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 20. ActionScript: Write Scripts > Initialize the document

Initialize the document

Applications have an initial state that specifies how the content first appears to users. You initialize properties and variables in the first frame of a document. You’ll specify that the map movie clip should not be visible when the SWF file first plays.

Select Frame 1 of the Actions layer. If the Actions panel isn’t open, select Window > Actions.

Actions - Frame appears at the top of the panel, which indicates that you selected a frame in which to apply ActionScript. It’s a good practice to verify that you’re attaching ActionScript to the intended frame or object.

The Actions panel includes a Script pane, the blank text entry area, in which you can enter text directly; an Actions toolbox, which lets you select ActionScript to add to your script; and a Script navigator, which functions like the Movie Explorer.

Along the top of the Actions panel, click Insert Target path.

In the Insert Target Path dialog box, verify that Relative, meaning relative path, is selected. From the hierarchical tree in the dialog box, select screen_mc. Click OK.

A target path tells ActionScript the location of an object within the overall structure of a document. For more information about paths, see “Using absolute and relative target paths” in Flash Help.

Click in the Script pane, at the end of the screen_mc text, and type a period (.).

When you type the period, code hints appear for the movie clip, because you used the _mc suffix when naming the instance. Double-click _visible from the list of code hints, and type the following: = false;

This line of code makes the screen_mc movie clip invisible on the Stage.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint