作者cjcat2266 (CJ Cat)
看板Flash
标题Re: [问题] 新手急问 语法问题
时间Thu May 1 01:04:55 2008
※ 引述《liuguai (小乖)》之铭言:
: 我做了一个按钮
: 是想要用ActionScript去控制
: rollover 跟 release
: 可是现在按下去会乱掉阿><
: 新手急问
: 希望有人能帮助我><
: 原始档http://192.192.155.219/liuguai/all.fla
: swf档 http://192.192.155.219/liuguai/all.swf
因为当你图片滑走的时候
就会触发onRollOut
然後之後又一直重复处发onRollIn和onRollOut
因为图片一直 "移到滑鼠下面、移开滑鼠下面、移到滑鼠下面..." 这样
我的做法是
把那个元件上面的on handler全部去掉
然後bj3的第一格打上下列code
function rOver():Void {
gotoAndPlay(2);
this.onRollOver = null; //移除 onRollOver
this.onRollOut = rOut; //设定 onRollOut 为 rOut
this.onRelease = mouseRelease; //设定 onRelease 为 mouseRelease
}
function rOut():Void {
gotoAndPlay(9);
this.onRollOver = rOver; //设定 onRollOver 为 rOver
this.onRollOut = null; //移除 onRollOut
this.onRelease = null; //移除 onRelease
}
function mouseRelease():Void {
gotoAndPlay(19);
this.onRollOut = null; //移除 onRollOut
this.onRelease = null; //移除 onRelease
}
this.onRollOver = rOver; //设定 onRollOver 为 rOver
这样会一按下去之後就一直跑到最後一格,不会回来了
如果要回来,请在最後一格加上
this.onRelease = function():Void {
gotoAndStop(1); //跳回第一格
this.onRelease = null; //移除此功能
}
--
CJ Cat = Croa'J Cat = Cockroach Cat = 西街凯特 = 蜚蠊猫 = 蟑螂猫
Blog
http://cjcat.blogspot.com
Gallery
http://cjcat2266.deviantart.com
ptt2 Board CJWorkshop - 阿多比闪光(Adobe Flash)研讨区
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.228.84.82
1F:推 liuguai:感谢你的回答^^问题解决了! 05/01 20:50