微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

当用于控制影片剪辑时,Adobe Animate CC按钮无法正常工作

如何解决当用于控制影片剪辑时,Adobe Animate CC按钮无法正常工作

我使用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 举报,一经查实,本站将立刻删除。