Copy And Modify A Button Function - MACROMEDIA FLASH 8-FLASH Tutorials Manual

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

Advertisement

232 ActionScript: Write Scripts
Copy and modify a button
function
You just created one function that sets the
clip to
when the user releases the mouse button after a button click.
true
You can probably guess how to create another function that hides the
movie clip: by setting the movie clip
screen_mc
when the user clicks an Off button. You'll create that function now.
false
1.
In the Script pane, select the entire function that you just typed,
including the comment, curly brackets, and semicolon. Copy the text as
you normally would, using Control+C (Windows) or Command+C
(Macintosh).
2.
In the Script pane, place the insertion point after the last line of code.
Then press Enter (Windows) or Return (Macintosh) twice, and paste
the text as you normally would, using Control+V (Windows) or
Command+V (Macintosh).
3.
In the copied function, change the text in
.
offButton_btn
Remember, earlier you assigned an instance name of
to an instance.
4.
In the copied function, change the
movie clip from
true
5.
In the copied function, change the commented text after the slashes to
read
function to hide animation
Your entire script should appear as follows:
// Initialize document to hide screen movie clip.
this.screen_mc._visible = false;
// function to show animation
this.onButton_btn.onRelease = function(){
screen_mc._visible = true;
};
// function to hide animation
this.offButton_btn.onRelease = function(){
screen_mc._visible = false;
};
visible
onButton_btn
visible
to
.
false
.
property of a movie
property to
_visible
to read
offButton_btn
property of the
screen_mc

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?

Subscribe to Our Youtube Channel

Table of Contents

Save PDF