高级执事
阅读权限 2
积分 3114
侠名
UID 22712
主题
帖子
精华
好友
银子
金子
贡献
威望
推广
活跃
荣耀
注册时间 2020-4-18
最后登录 1970-1-1
在线时间 小时
个人主页
|
楼主 |
发表于 2023-7-11 09:53:31
|
显示全部楼层
import flash.events.MouseEvent;
import flash.events.Event;
wheel_mc.stop();
var Rot=0;
var actMode;
var playStep=0;
var Pn=1;
drag_btn.addEventListener(MouseEvent.MOUSE_DOWN,chgYes);
function chgYes(me:MouseEvent){
actMode="yes";
}
drag_btn.addEventListener(MouseEvent.MOUSE_UP,chgNo);
function chgNo(me:MouseEvent){
actMode="no";
}
jog_mc.addEventListener(MouseEvent.MOUSE_MOVE,chkRot);
function chkRot(me:MouseEvent){
if(actMode=="yes"){
var mX=jog_mc.mouseX;
var mY=-jog_mc.mouseY;
Rot=Math.atan2(mX,mY)/(Math.PI/180);
drag_btn.rotation=Rot;
}
}
stage.addEventListener(Event.ENTER_FRAME,cirPlay);
function cirPlay(me:Event){
Pn=1;
if(Rot<0){
Pn=-1;
}
playStep=Math.floor(Math.abs(Rot)/30);
if(playStep>5){
playStep=5;
}
fps_txt.text=String(playStep*12*Pn);
for(var i=1;i<=playStep;i++){
if(Pn>0){
wheel_mc.nextFrame();
if(wheel_mc.currentFrame==wheel_mc.totalFrames){
wheel_mc.gotoAndPlay(1);
}
}else{
wheel_mc.prevFrame();
if(wheel_mc.currentFrame==1){
wheel_mc.gotoAndPlay(wheel_mc.totalFrames);
}
}
}
}
|
|