对不起,不是很像
看效果先:
_global.OVER = 0;
//全局变量
var tupianshu = 9;
//图片数目9
//---局部变量申明(听说能提高访问速度!!^_^!!)--------------------
var pic_x1;
var pic_x2;
var pic_x3;
var pic_x4;
var pic_x5;
var pic_x6;
var pic_x7;
var pic_x8;
var pic_x9;
//---载入图片-----------------------
for (var i = 1; i<=tupianshu; i++) {
_root.attachMovie(i, i, i);
_root._x = 85*i+80;
_root._y = Stage.height-60;
_root._xscale = 30;
_root._yscale = 30;
this["pic_x"+i] = _root._x;
//把图片的原始X轴斌给"pic_x"+i
}
//-------------鼠标滑入滑出事件------
for (var i = 1; i<=tupianshu; i++) {
_root.onRollOver = function() {
_global.OVER = 1;
//this.over = 1;
};
_root.onRollOut = function() {
_global.OVER = 0;
//this.over = 0;
};
}
//------------------自定义函数------------------
function pingguo() {
for (var i = 1; i<=tupianshu; i++) {
if (_xmouse>_root._x) {
scalex = (100-(_xmouse-_root._x)/2-_root._xscale);
scaley = scalex;
if (_global.OVER == 1 && _root._xscale>=30) {
_root._xscale += scalex;
_root._yscale += scaley;
if (_xmouse-this["pic_x"+i]<1000) {
_root._x = this["pic_x"+i]-(_xmouse-this["pic_x"+i])/2;
}
//trace(this["pic_x"+i])
}
}
if (_xmouse<=_root._x) {
scalex = (_root._xscale-(100-(_root._x-_xmouse)/2));
scaley = scalex;
if (_global.OVER == 1 && _root._xscale>=30) {
_root._xscale -= scalex;
_root._yscale -= scaley;
if (this["pic_x"+i]-_xmouse<1000) {
_root._x = this["pic_x"+i]-(_xmouse-this["pic_x"+i])/2;
}
}
}
if (_global.OVER == 0) {
//归位
_root._xscale -= (_root._xscale-30)/2;
_root._yscale -= (_root._yscale-30)/2;
_root._x += (this["pic_x"+i]-_root._x)/10;
}
if (_root._xscale<=30) {
_root._xscale = 30;
}
if (_root._yscale<=30) {
_root._yscale = 30;
}
//限制
if (_root._x>this["pic_x"+i]) {
if (_root._x-this["pic_x"+i]>=100) {
_root._x = this["pic_x"+i]+100;
}
}
if (_root._x<this["pic_x"+i]) {
if (this["pic_x"+i]-_root._x>=100) {
_root._x = this["pic_x"+i]-100;
}
}
}
}
kingofkof_126_com = onEnterFrame=function () {
pingguo()
}
源文件下载:
仿苹果的菜单.rar进入论坛学习讨论:
http://space.flash8.net/bbs/thread-339244-1-1.html