Flash alternative effect of transparent button design

Source: Internet
Author: User
Tags contains window
Button | design | transparent

This example is mainly to introduce a kind of alternative, practical buttons-transparent button. Through the study of this article, the reader can not only grasp the two kinds of practical button production methods, but also learn some simple actions, can be described as much.

   Effect Preview Chart:

Click here to download

Production steps:

1. Open Flash MX 2004, as shown in Figure 1, to create a new flash document. Press the shortcut key CTRL+F3 open the Properties panel, click the Document Properties button to open the Document Properties Panel (accelerator ctrl+j), set the scene size to 200px x 120px, the background color to white, and the frame frequency to 12fps. As shown in Figure 2.

2. Click the buttons command in the window → other panel → Common Library to open the buttons library. Drag the button Arcade Button-orange from the "Arcade Buttons" folder into Scenario 1 as shown in Figure 3.

3. Click "button" in the scene, press the shortcut key F9 Open the Actions panel, enter the following code:

Executes the statement when the mouse presses the button and then releases it
On (release) {
Let the button transparency property value decrease by 10 to get a new transparent value
This._alpha-= 10;
Resets the transparency value of a button to 100 when the variable is less than zero, that is, when the button is not visible
if (this._alpha<0) {
This._alpha = 100;
}
}

The _alpha property in the code is the movie transparency property, and the value is between 0-100. When a movie clip has an alpha value of 0 o'clock, the movie clip is completely transparent, and if the alpha value is 100, the movie clip is completely visible.

In code, the IF statement works if the movie instance is fully transparent, the reset transparency value is 100, making the button fully visible. This refers to a movie clip instance that contains the script when the script executes, and when the method of an object is invoked, this contains a reference to the object of the method being invoked, and in the button's on event, this refers to the timeline that contains the button, and in the Onclipevent event of the movie clip, This refers to the timeline of the movie clip itself.

By extension, in some game design, the designer needs to let a component in the game (including the button) after the trigger disappears, then how to do? can be hidden or deleted by the method.

The _visible property determines whether the movie is visible and is disabled when the movie is not visible
this._visible = 0;
Use this statement to delete a movie clip instance that was created by the Attachmovie or Duplicatemovieclip method of the MovieClip object or by a control statement Duplicatemovieclip
Removemovieclip (target);

In addition, the reader can set the transparency of the button, so that it is dark, and then hit the Ming. In short, master _alpha and other attributes of the use of the flexible transparent button (or transparent components) in their work, there will be unexpected results.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.