问题描述
我使用4个关键帧来区分按钮的活动状态和非活动状态。当我从头到尾运行MovieClip时出现错误,然后使用按钮返回上一步。
在开始帧上,只有“播放”和“下一步”按钮处于活动状态。
var root = this;
root.stop();
root.btnPlay.on('click',function () {
root.gotoAndStop('playing');
root.mcAnimate.play();
});
root.btnNext.on('click',function () {
root.gotoAndStop('middle');
root.mcAnimate.gotoAndStop('First state');
});
单击“播放”按钮时,转到“播放帧”,将“播放”更改为“暂停”,然后启用“重新加载”按钮。
var root = this;
root.stop();
root.btnPause.on('click',function(){
root.gotoAndStop('middle');
root.mcAnimate.stop();
});
root.btnReload.on('click',function(){
root.gotoAndStop('start');
root.mcAnimate.gotoAndStop('Intial state');
});
结束帧,只有“上一步”和“重新加载”按钮处于活动状态。
var root = this;
root.stop();
root.btnPrev.on('click',function(){
root.gotoAndStop('middle');
root.mcAnimate.gotoAndStop('Third state');
});
root.btnReload.on('click',function(){
root.gotoAndStop('start');
root.mcAnimate.gotoAndStop('Intial state');
});
中框最难,因为每个活动的按钮和下一步取决于MovieClip框标签。
var root = this;
var currentLabel = '';
root.stop();
root.btnPrev.on('click',function() {
var destination = '';
checkCurrentLabel();
if (currentLabel == 'First state') {
root.gotoAndStop('start');
destination = 'Intial state';
} else if (currentLabel == 'Second state') {
destination = 'First state';
} else if (currentLabel == 'Third state') {
destination = 'Second state';
} else if (currentLabel == 'End state') {
destination = 'Third state';
} else {
return;
}
root.mcAnimate.gotoAndStop(destination);
currentLabel = destination;
});
root.btnPlay.on('click',function(){
root.gotoAndStop('playing');
root.mcAnimate.play();
currentLabel = '';
});
root.btnNext.on('click',function(event){
var destination = '';
checkCurrentLabel();
if (currentLabel == 'Intial state') {
destination = 'First state';
} else if (currentLabel == 'First state') {
destination = 'Second state';
} else if (currentLabel == 'Second state') {
destination = 'Third state';
} else if (currentLabel == 'Third state') {
root.gotoAndStop('end');
destination = 'End state';
} else return;
root.mcAnimate.gotoAndStop(destination);
currentLabel = destination;
});
root.btnReload.on('click',function(){
root.gotoAndStop('start');
root.mcAnimate.gotoAndStop('Intial state');
currentLabel = '';
});
function checkCurrentLabel() {
if (currentLabel == '') {
currentLabel = root.mcAnimate.getCurrentLabel();
}
}
在影片剪辑中,帧标签的命名如下: 初始状态-> 第一状态-> 第二状态-> 第三状态-> 结束状态
从头到尾播放MovieClip时。工作了! 但是,如果在此之后按Prev和Next按钮,则会发生错误。请帮忙。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)