[ Pobierz całość w formacie PDF ]

the original start file.
3 Select Window > Panel Sets > Training Layout to modify your workspace for taking lessons.
Create an instance of a symbol
You ll drag an instance of an animated movie clip from the library to the Global Positioning
System artwork on the Stage. You ll then follow the recommended practice of always naming
instances both to prompt code-hinting and because in your scripts you generally refer to
instance names rather than symbol names. Code hints are the tooltips that prompt you with the
correct ActionScript syntax.
1 In the toolbar, click the Selection tool. Select the map layer in the Timeline, and click the
padlock next to the map layer to unlock that layer.
2 To place the movie clip accurately, select View > Snapping. Select Snap Align and Snap to
Objects if the commands are not already selected.
3 From the Library panel (Window > Library), drag map_skewed to the black background area
of the Stage.
Because guides don t appear when you first drag an object from the Library panel, you ll release
the object and then drag it again.
28 Chapter 3: Write Scripts with ActionScript
4 Drag the map_skewed movie clip on the Stage again so that the align guides appear. Use the
guides to align the movie clip to the top and left edges of the GPS screen.
Note: If you make an error in placement, either drag the movie clip again, or press Control+Z
(Windows) or Command+Z (Macintosh) to undo your changes.
5 With the instance of map_skewed selected on the Stage, type screen_mc in the Instance Name
text box of the Property inspector (Window > Properties).
Flash is designed to present code hints when you name your instances with the
appropriate suffix:
 % When naming a movie clip instance, always give the instance a suffix of _mc, as
in screen_mc.
 % When naming a button, use the _btn suffix.
 % When naming a text field, use the _txt suffix.
Note: For more information about additional instance name suffixes that prompt code hints, see
 Writing code that triggers code hints in ActionScript Reference Guide Help.
Name button instances
Using the appropriate suffix to prompt code hinting, you ll provide instance names for two
button instances that are already on the Stage.
1 In the Timeline, unlock the Buttons layer.
2 On the Stage, select the instance of play_button (the large green button).
3 In the Instance Name text box of the Property inspector, type onButton_btn to name
the instance.
4 On the Stage, select the instance of button_stop (the small red button).
5 In the Instance Name text box of the Property inspector, type offButton_btn to name
the instance.
Name button instances 29
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
not be visible when the SWF file first plays.
1 Select Frame 1 of the Actions layer. If the Actions panel isn t open, select Window >
Development Panels > 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.
2 Along the top of the Actions panel, click Insert Target path.
3 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. Then click OK.
A target path tells ActionScript the location of an object within the overall structure of
a document.
4 Click in the Script pane, at the end of the screen_mc text, and type a period (.).
5 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.
Note: If code hints don t appear, you don t have code hints selected as a preference in the Actions
panel. You can type _visible directly in the Script pane. You can also change your preferences by
clicking the options menu in the upper right corner of the Actions panel. From the options menu, [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • granada.xlx.pl
  •