将你要用的菜单movieclip linkage一下,实例名一次是icon0、icon2……当然也可以自己命名,但是attachMovie函数里的东东就要一起改,“var IconNumber = 6;”是菜单项目的数量
复制内容到剪贴板
代码:
<br>var menu_Lables = new Array("", "", "", "", "", "");//menu<br>var menu_URLs = new Array("","","","","","");//URL<br>var menu_minScale = 70;<br>var menu_maxScale = 70;<br>var menu_StartX = 300;<br>var menu_StartY = 50;<br>var IconNumber = 6;<br>var Icon_minScale = 40;<br>var Icon_maxScale = 50;<br>var Icon_Space = 20;<br>var DockMenu = createEmptyMovieClip("dmenu", 10);<br><br>DockMenu._x = menu_StartX;<br>DockMenu._y = menu_StartY;<br><br>var i = 0;<br>while (i < IconNumber)<br>{<br> var theItem = DockMenu.attachMovie("icon" + i, "item" + i, i + 10);<br> theItem.attachMovie("label", "ilabel", 10);<br> theItem.preItem = DockMenu["item" + (i - 1)];<br> theItem._xscale = Icon_minScale;<br> theItem._yscale = Icon_minScale;<br> theItem._x = Math.floor(theItem.preItem._x + theItem.preItem._width + Icon_Space);<br> theItem.ilabel.label.text = menu_Lables[i];<br> theItem.ilabel._visible = false;<br> theItem.URL = menu_URLs[i];<br> theItem.onRollOver = function ()<br> {<br> this.ilabel._visible = true;<br> };<br> theItem.onReleaseOutside = function ()<br> {<br> this.ilabel._visible = false;<br> };<br> theItem.onRollOut = function ()<br> {<br> this.ilabel._visible = false;<br> };<br> theItem.onRelease = function ()<br> {<br> getURL(this.URL, "_blank");<br> };<br> theItem.onEnterFrame = function ()<br> {<br> if (this._parent.mover)<br> {<br> var scale = Icon_maxScale - Math.abs(DockMenu._xmouse - this._x - 30) / 5;<br> if (scale < Icon_minScale)<br> {<br> scale = Icon_minScale;<br> } // end if<br> this._xscale = this._xscale + (scale - this._xscale) / 3;<br> this._yscale = this._yscale + (scale - this._yscale) / 3;<br> } // end if<br> if (this._parent.mout)<br> {<br> this._xscale = this._xscale + (Icon_minScale - this._xscale) / 3;<br> this._yscale = this._yscale + (Icon_minScale - this._yscale) / 3;<br> } // end if<br> this._x = this._x + (this.PreItem._x + this.PreItem._width + Icon_Space - this._x) / 3;<br> };<br> i++;<br>} // end while<br>DockMenu.onEnterFrame = function ()<br>{<br> if (this.mover)<br> {<br> this._xscale = this._xscale + (menu_maxScale - this._xscale) / 4;<br> this._yscale = this._yscale + (menu_maxScale - this._yscale) / 4;<br> } // end if<br> if (this.mout)<br> {<br> this._xscale = this._xscale + (menu_minScale - this._xscale) / 4;<br> this._yscale = this._yscale + (menu_minScale - this._yscale) / 4;<br> } // end if<br> this._x = this._x + (-this._width / 2 + menu_StartX - this._x) / 3;<br>};<br>DockMenu.onMouseMove = function ()<br>{<br> if (this.hitTest(_root._xmouse, _root._ymouse, false))<br> {<br> this.mover = true;<br> this.mout = false;<br> }<br> else<br> {<br> this.mover = false;<br> this.mout = true;<br> } // end if<br>};<br>DockMenu.mover = true;<br><br>