[分享]大家来看这种较酷的导航按钮
点击浏览该文件 这里是我写的比较简单的教程,希望对大家有所帮助. 1.先创建一个MC,在其中放入一个动态文本框,命名为zjs,在把这个MC拖8个放在场景中命名为zjs1-zjs8(注意使MC的横坐标不同,这样可以使开始播放影片时有较酷的效果). 2.再在场景中放一个动态文本设置其变量为zjs_name,以显示你选中的哪一个按钮. 3.在场景的第一帧写上stop(); 4.在地场景中建一层命名为AS用以写动作脚本.
myname = ["闪吧论坛","闪吧源码","闪吧教程","闪吧动画","闪吧游戏","闪吧音效","闪吧图库",闪吧字库"]//在每个MC(zjs1-zjs8)的动态文本中要显示的内容 zjs_y = [];//为0,以后赋值 for (var i = 0; izjs_y[i] = (i+1)*30+20; _root["zjs"+(i+1)]._y = zjs_y[i]; } //给每个MC(zjs1-zjs8)的纵坐标赋值 for (var i = 0; ithis["zjs"+(i+1)].zjs = myname[i]; } //写入每个MC内文本的内容 MovieClip.prototype.move = function(click, speed, start_x, start_y, end_x, end_y) {//speed 为缓冲系数 if (click) { this._x += (end_x-this._x)/speed; this._y += (end_y-this._y)/speed; //缓冲效果 if (-this._x+end_x<1) { this.enabled = 1; } else { this.enabled = 0; } //运动过程中按钮失效 zjs_name = this.zjs; } else { this._x += (start_x-this._x)/speed; this._y += (start_y-this._y)/speed; if (this._x-start_x<1) { this.enabled = 1; } else { this.enabled = 0; } } }; MovieClip.prototype.myclick = function(n) { for (var i = 1; i<=myname.length; i++) { if (i == n) { _root["click"+i] = true; } else { _root["click"+i] = false; } } }; onEnterFrame = function () { for (var i = 0; ithis["zjs"+(i+1)].move(eval("click"+(i+1)), 4, 50, zjs_y[i], 275, 200); } }; zjs1.onRollOver = function() { myclick(1); }; zjs2.onRollOver = function() { myclick(2); }; zjs3.onRollOver = function() { myclick(3); }; zjs4.onRollOver = function() { myclick(4); }; zjs5.onRollOver = function() { myclick(5); }; zjs6.onRollOver = function() { myclick(6); }; zjs7.onRollOver = function() { myclick(7); }; zjs8.onRollOver = function() { myclick(8); }; for (var i = 1; i<=myname.length; i++) { this["zjs"+i].onRelease = function() { getURL("http://www.Flash8.net"); }; } 点击浏览该文件 |
关键词:导航 |