Adobe Flash

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.

Add comments to ActionScript

In ActionScript, text after double slashes (//) is commented text, which Macromedia Flash Player ignores. Commented text often documents script functionality so that other developers can understand your script, but you can also use comments to deactivate sections of your script when debugging. As a best practice, always add comments that explain your scripts.

  • In the Script pane of the Actions panel, place the insertion point at the beginning of the line of code and type // Initialize document to hide screen movie clip. Press Enter (Windows) or Return (Macintosh).

    Text in the Script pane appears as follows:

    // Initialize document to hide screen movie clip.
    
    this.screen_mc._visible = false;
    

Note

If your commented text is many lines, you can use /* instead of double slashes for the beginning of the comment, and */ to mark the end of the comment.


by BrainBellupdated
Advertisement: