The effect of Flash making Mac system menu

Source: Internet
Author: User
Tags abs eval
Menus first need to import all the menus, or you can import them into the MC using the program. I'm just writing a tutorial here, so just drawing a rectangle has an effect.
Note, however, that you must align the coordinates of a single menu to 0, 0, and watch the effect:

Click here to download the source file


Flash as code as follows;
Stage.align = "TL";
The scene is the upper left corner;
Stage.scalemode = "Noscale";
Control animation does not automatically scale;
function boxcopy (macmenuname, step, Menuxw, Max, ScaleX, Menux, Menuy) {
Createemptymovieclip (Macmenuname, 1);
Create the corresponding MovieClip according to the function parameters;
for (var i = 0; i<max; i++) {
Macmenuboxnum = eval (macmenuname). Attachmovie (Macmenuname, "Macmenuboxname" +i, i);
The number of menus given by function parameters is loaded into the movieclip just created;
MacMenuBoxNum.Num.text = i+1;
This sentence is used to test the display result of the function;
Macmenuboxnum.onrelease = function () {
Trace (this);
};
This defines the program that the menu executes after clicking;
Macmenuboxnum.onenterframe = Scalebox;
This sentence controls the function placed by the call menu;
}
var menuboxheight = eval (macmenuname). _height;
Onenterframe = function () {
Menux = Menux = = NULL | | Menux = "" | | Menux = = undefined? 0:menux;
Menuy = Menuy = = NULL | | Menuy = "" | | Menuy = = undefined? 0:menuy;
for (var i = 0; i<max; i++) {
var macmenuboxnum = eval (macmenuname) ["Macmenuboxname" +i];
Reference object;
macmenuboxnum._x = eval (macmenuname) ["Macmenuboxname" + (i-1)]._x+eval (macmenuname) ["Macmenuboxname" + (i-1)]._width +MENUXW;
The arrangement mode of initialization menu;
macmenuboxnum._y = eval (macmenuname). _y-macmenuboxnum._height;
Eval (macmenuname). _x = (Stage.width-eval (macmenuname). _width)/2+menux;
Eval (macmenuname). _y = Menuboxheight+menuy;
Control the coordinates of the menu;
}
};
function Scalebox () {
MouseX = Math.Abs (This._x+this._width/2+eval (macmenuname). _x-_root._xmouse);
Mousey = Math.Abs (This._y+eval (macmenuname). _y-_root._ymouse);
Get the distance between mouse and menu;
if (Mousex<=scalex && mousey<=menuboxheight* (scalex+100)/100) {
Get the effective range of menu response mouse;
This._xscale + = (100+ (scalex-mousex)-this._xscale)/step;
This._yscale + = (100+ (scalex-mousex)-this._yscale)/step;
Scale the size of the menu;
} else {
This._xscale + = (100-this._xscale)/step;
This._yscale + = (100-this._yscale)/step;
The Restore menu is placed;
}
}
}
Boxcopy ("Boxname", 5, 10, 15, 120, 0, 50);
Boxcopy (The MovieClip name of the Attachmovie connection, the number of frames required for scaling, the spacing between the menu items, the total number of menus, the scaling ratio, the X coordinates of the menu, and the y-coordinate of the menu);

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.