Imitation Apple system menu

Source: Internet
Author: User

Code details:

// ======================= Start of the copyright disclaimer ================================== //
//★Taosha network: http://www.taoshaw.com
//★All tutorials of Taosha network are welcome to be reprinted. However, please indicate the source when reprinting. Thank you for your cooperation.
// ========================= End of the copyright disclaimer ================================== //
// Define the linked array. Using arrays can improve code running efficiency.
Var menu_URLs = new Array ("Http://www.taoshaw.com "," http://www.taoshaw.com "," http://www.taoshaw.com ",
"Http://www.taoshaw.com", "http://www.taoshaw.com", "http://www.taoshaw.com");
// Minimum abbreviated range
Var menu_minScale = 100;
// Maximum extended range
Var menu_maxscaling = 130;
// Position X at the beginning of the navigation bar
Var menu_StartX = 280;
// Position Y at the beginning of the navigation bar
Var menu_StartY = 200;
// ICON count
Var IconNumber = 9;
// Narrow down the ICON
Var Icon_minScale = 30;
Var Icon_maxScale = 60;
Var Icon_Space = 4;
// Create a navigation menu here
// Copy the background
Var DockMenu = createEmptyMovieClip ("dmenu", 10 );
// Set the location of the background element
DockMenu. _ x = menu_StartX;
DockMenu. _ y = menu_StartY;
// Call the ICON in the library to the scene
For (var I = 0; I <IconNumber; I ++ ){
// Copy the ICON
Var theItem = DockMenu. attachMovie ("icon" + I, "item" + I, I + 10 );
TheItem. attachMovie ("label", "ilabel", 10 );
TheItem. preItem = DockMenu ["item" + (i-1)];
TheItem. _ x = theItem. preItem. _ x + theItem. preItem. _ width + Icon_Space;
TheItem. ilabel. _ visible = false;
// Set the link object
TheItem. URL = menu_URLs;
TheItem. _ xscale = Icon_minScale;
TheItem. _ yscale = Icon_minScale;
TheItem. onRelease = function (){
GetURL (this. URL );
  }
// This is used to display the status of the icon when you move the mouse up or down.
TheItem. onEnterFrame = function (){
If (this. _ parent. mover ){
Var scale = Icon_maxScale-Math.abs (DockMenu. _ xmouse-this. _ X-30)/5;
If (scale <Icon_minScale) scale = Icon_minScale;
// Zoom ratio
This. _ xscale + = (scale-this. _ xscale)/3;
This. _ yscale + = (scale-this. _ yscale)/3;
   }
If (this. _ parent. mout ){
This. _ xscale + = (Icon_minScale-this. _ xscale)/3
This. _ yscale + = (Icon_minScale-this. _ yscale)/3
   }
This. _ x + = (this. PreItem. _ x + this. PreItem. _ width + Icon_Space-this. _ x)/3;
  }
}
Var theBGBox = DockMenu. attachMovie ("bgbar", "bgbox", 1 );
TheBGBox. onEnterFrame = function (){
This. _ x = DockMenu ["item0"]. _ x;
This. _ width = DockMenu ["item" + (IconNumber-2)]. _ x + DockMenu ["item" + (IconNumber-2)]. _ width-DockMenu ["itemCon"]. _ x;
  }
  
DockMenu. onEnterFrame = function (){
If (this. mover ){
This. _ xscale + = (menu_maxScale-this. _ xscale)/4;
This. _ yscale + = (menu_maxScale-this. _ yscale)/4;
}
If (this. mout ){
This. _ xscale + = (menu_minScale-this. _ xscale)/4;
This. _ yscale + = (menu_minScale-this. _ yscale)/4;
  }
This. _ x + = (-this. _ width/2 + menu_StartX-this. _ x)/3;
}
DockMenu. onMouseMove = function (){
If (this. hitTest (_ root. _ xmouse, _ root. _ ymouse, false )){
This. mover = true;
This. mout = false;
} Else {
This. mover = false;
This. mout = true;
}
}
// AD
Ad_text.border = 0;
Ad_text.html = true;
Ad_text.htmlText = "<a href = 'http: // www.taoshaw.com ', target =' _ blank '> Taosha Net original tutorial series: http://www.taoshaw.com </a> ";

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.