Javascript Adobe Animate CC按钮在用于控制电影剪辑时无法正常工作
我使用4个关键帧来区分按钮的活动和非活动状态。当我从头到尾运行MovieClip,然后使用按钮返回到前面的步骤时,会发生错误 在开始帧上,只有“按钮播放”和“下一步”处于活动状态Javascript Adobe Animate CC按钮在用于控制电影剪辑时无法正常工作,javascript,html5-canvas,createjs,adobe-animate,Javascript,Html5 Canvas,Createjs,Adobe Animate,我使用4个关键帧来区分按钮的活动和非活动状态。当我从头到尾运行MovieClip,然后使用按钮返回到前面的步骤时,会发生错误 在开始帧上,只有“按钮播放”和“下一步”处于活动状态 var root = this; root.stop(); root.btnPlay.on('click', function () { root.gotoAndStop('playing'); root.mcAnimate.play(); }); root.btnNext.on('click',
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.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');
});
单击“播放”按钮后,转到播放帧,将“播放”更改为“暂停”,启用“重新加载”按钮
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');
});
结束帧,只有按钮Prev和Reload处于活动状态
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.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();
}
}
在电影剪辑中,帧标签的命名如下:
初始状态-->第一状态-->第二状态-->第三状态-->结束状态
当我从头到尾播放电影时。成功了!
但若我在那个之后按下“上一步”和“下一步”按钮,就会发生错误。请帮忙