flash as2.0 小问题-加分

来源:百度知道 编辑:UC知道 时间:2024/06/08 04:10:27
代码如下:
if(!answerpressed&&hepressed){
mc.heanswer.onRelease=function(){
trace(hepressed);
mc.heline._visible=true;
mc.he.gotoAndStop(1);
mc.he.onRelease=function(){}
mc.heanswer.onRelease=function(){}
}}

怎么不行呢,trace(hepressed);中也输出false,程序怎么就执行了呢,给个指点啊,加分

mc.heanswer.onRelease = function() {
if (!answerpressed && hepressed) {
trace(hepressed);
mc.heline._visible = true;
mc.he.gotoAndStop(1);
}
};
mc.he.onRelease = function() {
};

注意,if语句在这个帧上,如果只播放此帧一次,那么它就只执行一次,如果一开始你的值是true的,那么它就会一直是true,所以要把它放在点击事件里,这样每点击一次就会判断一次你的值。