Flash makes a beautiful Korean pull-down menu

Source: Internet
Author: User
Menu | dropdown

First look at the effect

Click here to download the source file

First create a new canvas size for 250*600 set canvas color to white slightly to beautify the background

Then we're going to do the background of the 4 button buttons when the mouse is not touching it is long 165 high 30 gray fast, when the mouse touches the button we change the background to a different color and then the 4 buttons are renamed "Anniu1", "Anniu2" "Anniu3" "Anniu4", You can also change the font color when you touch the mouse by creating a new layer on the button and a text caption with a button.

Now put the 4 buttons you've just made into four movie clips and name the clips "button 1", "button 2, button 3, button 4, in the movie clip's property bar, change the clip's instance name to" MC1 "," MC2 "," MC3 "," MC4 ".

Create a new 4 layer in the movie clip "button 1" because we're going to do three downlevel menus and a layer write script.

In the movie clip "button 1", the 2nd pin of all layers inserts the key pin in the three sub-menu layer 2nd stitch Each of the 3 small buttons to do the subordinate menu, in turn, in each layer.

Next we're going to add the first and 2nd stitches in the first script-writing layer.

Stop ();

Then we add code to the "ANNIU1" button in the movie clip "button 1"

On (release) {
if (i = = 0) {
gotoAndStop (2);
i = 1;
} else {
gotoAndStop (1);
i = 0;
}
}//only when the mouse presses and releases on the button, determines whether the variable i equals 0 if equal to 0 then jumps to the 2nd stitch and assigns I to 1 if the variable i does not equal 0 then jumps to the first stitch and assigns I to 0, according to this practice

The "button 2", "button 3", "Button 4" submenu also follow the "button 1" method to do the same also do not forget to add the script, after we put code on the movie clip, in the movie clip "button 1" on the Write

Onclipevent (load) {
i = 0;
}//I is assigned to 0 when a movie clip appears on the timeline

Write on the movie clip button 2

Onclipevent (load) {
i = 0;
Speed = 0.3;//Set the speed of the move
}
Onclipevent (enterframe) {
this._y = this._y+ (_parent.mc1._y+_parent.mc1._height-this._y) *this.speed;
}

The actual effect of this formula is to calculate the position and speed of the "button 2" move when button 1 does not bounce out of the menu we find the latter part of the formula (_parent.mc1._y+_parent.mc1._height-this._y) *this.speed The value is actually 0, and when the submenu is popped (_parent.mc1._y+_parent.mc1._height-this._y) refers to the height of the Extra submenu. And then move it up the moving speed of 0.3 button 2 automatically down to the right position, a relative path _parent is used in the formula, and in the relative path, _parent indicates that the parent timeline of the current timeline, the level of the movie clip, is raised one level and then written on button 3 in turn.

Onclipevent (load) {
i = 0;
Speed = 0.3;
}
Onclipevent (enterframe) {
this._y = this._y+ (_parent.mc2._y+_parent.mc2._height-this._y) *this.speed;
}

Write on button 4

Onclipevent (load) {
i = 0;
Speed = 0.3;
}
Onclipevent (enterframe) {
this._y = this._y+ (_parent.mc3._y+_parent.mc3._height-this._y) *this.speed;
}

Okay, now we can export it, see how it works.



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.