一、项目常用的全局事件,总结
S = this;
S.stop();
//下一步播放事件
nextPlay = function (event) {
numframe = S.currentFrame;
S.gotoAndPlay(numframe + 1);
}
//上一步播放事件
PrePlay = function (event) {
numframe = S.currentFrame;
S.gotoAndPlay(numframe - 1);
}
//多点击跳转
for (var i = 1; i <= 4; i++) {
if (!S["start_btn" + i].hasEventListener("click")) {
S["start_btn" + i].addEventListener("click", funClick);
}
}
function funClick(e) {
var num = e.currentTarget.name.charAt(9);
switch (num) {
case "1":
S.gotoAndPlay("task1")
break;
case "2":
S.gotoAndStop("task2")
break;
case "3":
S.gotoAndStop("task3")
break;
case "4":
S.gotoAndStop("task4")
break;
}
}
//封装隔帧跳转
preFz = function (btn, txt) {
if (!btn.hasEventListener("click")) {
btn.addEventListener("click", prefun);
}
function prefun(){
S.gotoAndStop(txt)
}
}