Write A Function For A Button - MACROMEDIA FLASH 8-FLASH Tutorials Manual

Hide thumbs Also See for FLASH 8-FLASH:
Table of Contents

Advertisement

Write a function for a button

A command in ActionScript is called a function. A function is a script that
you can write once and use repeatedly in a document to perform a certain
task. You're going to write a function that makes the screen_mc movie clip
appear (
visible = true
1.
In the Script pane of the Actions panel, click after the last line of code,
press Enter (Windows) or Return (Macintosh) twice, and type
function to show animation
2.
Press Enter or Return and click Insert Target Path, along the top of the
Actions panel. Select onButton_btn from the hierarchical tree, and
click OK.
3.
In the Script pane, type a period (.) and double-click
the list of code hints that appears.
4.
In the Script pane, press the Spacebar and type the following:
= function(){
The line of code that you just completed should appear as follows:
this.onButton_btn.onRelease = function(){
You already know how to select objects in the Insert Target Path dialog
box; you'll now enter the instance names directly into the Script pane.
5.
Press Enter or Return, and type the following:
screen_mc._visible = true;
6.
Press Enter or Return and type
The function should appear as follows:
// function to show animation
this.onButton_btn.onRelease = function(){
screen_mc._visible = true;
};
) when the user releases the mouse button.
to specify the end of the statement.
};
//
from
onRelease
Write a function for a button 231

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-FLASH and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF