Flash Beginner's Tutorial: button making

Source: Internet
Author: User
Tags modify
Button | beginners | tutorial Animation Demo:

Click here to download the source file

Well, we made a button today that has the as code. Main as (do not copy the following code, or you will get an error):

Movieclip.gotoandplay (frame)

Make a movie clip play to which frame.

Movieclip.gotoandstop (frame)

Make a movie clip stop to which frame.

On (MouseEvent) {
Statement
}

This means: MouseEvent can have the following functions:

Press down
Release press and let go
Rollover move into button area
RollOut move out of button area
DragOver Button Area
Dragout Drag out button area
KeyPress "button" Press a key (I do not recommend)

Okay, not much, we'll create a new document and click "Insert" to create a new component:

Well, click on "Library", double-click the button btn just edited, and here is its 3 frames:

Drag the button btn into the main scene, click it, open the Action panel, and enter the following code:

On (release) {
_root.sshow.gotoandplay (2);
}

_root refers to the main scene, sshow refers to the movie clip, gotoAndPlay (2), which refers to playing to the second frame.
Create a new movie clip with the name Sho, right click on the second frame of the timeline, insert a blank keyframe, and draw a small ball:

Well, ah. Insert a keyframe at the 15th frame of the time, point to frame 15th, point to the drawn ball, click on the "Freeform tool", and then point to a point on the ball, hold down the "SHIFT" Zoom, then click on the "Modify" menu, click "Align", click "Vertically Centered", then click the "Modify" menu, click "Align", click " Horizontal Center ", OK, now frame 15th is like this:

Well, click at 15 to 2 frames, open the Properties panel, and create a shape tween. As part, well, click on frame 15th, open the Actions panel and write code:

gotoAndStop (1);

Stop to the first frame. Well, click on frame 1th to open the Actions panel and write the code:

Stop ();

Back to the main scene, put it in, click on it, open the Properties panel, its "instance name" to "Sshow" test it!

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.