Flash drop down menu flash pull-down menu Download

Source: Internet
Author: User
Tags setinterval

Write a simple Flash pull-down menu, all only blame my art too bad, do not too good-looking! But as a novice to learn the example is very good! You novice friends, can not miss!!
Production process:
1, the production of four buttons, respectively, written on Photo_1, Photo_2, Photo_3, Photo_4.
2, import four picture.
3, new four movie clips, the previous prepared button and picture one by one dragged into the clip, and the instance name is set to BT, and finally four clips are dragged into the four layers of the scene, respectively, and named Ph1,ph2,ph3,ph4.
Here's the code, adding the following code in the first frame:
_global.pre = "PH1";//To assign the diagram being displayed to the pre variable
For (I=1 i<5; i++) {//event with loop Write button
this["ph" +i].bt.onrelease = function () {
_global.speed = 0;//to make initial speed 0
_global.cur = this._parent._name;//assigns the clicked graph to the cur variable
Trace ("Pre:" +_global.pre);
Trace ("cur:" +_global.cur);
Id_up = SetInterval (this._parent._parent, "action_up", _global.pre);//action_up function once every 10ms!
};
}
var action_down = function (cur) {//The functions implement the clicked picture Down!
_global.speed + + 1;//to implement buffering effect
This[cur]._y + = _global.speed;//Move picture
if (this[cur]._y>=17.4) {//stop moving when a predetermined position is reached
this[cur]._y = 17.4;//prevents alignment
Clearinterval (Id_down);//Clear clock
_global.pre = cur;//to record the diagram being displayed to the pre variable
}
};
var action_up = function (pre) {//The functions implement the clicked image up-Move!
_global.speed + + 1;//to implement buffering effect
This[pre]._y-= _global.speed;//move picture
if (this[pre]._y<=-300) {//stop moving when a predetermined position is reached
this[pre]._y = -300;//prevents alignment
Clearinterval (ID_UP);//Clear clock
Id_down = SetInterval (This, "Action_down", "_global.cur"); Action_down function is called once every 10ms! Parameters passed by _global.cur
_global.speed = 0;//to make initial speed 0
}
};

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.