妙网科技 妙网科技 首页 妙网科技 Flash 妙网科技 FLASH中鼠标移动到一定区域停止播放动画代码

FLASH中鼠标移动到一定区域停止播放动画代码

所属栏目: Flash | 更新时间:2015-5-6 | 阅读:3718 次

FLASH中鼠标移动到一定区域停止播放动画代码:

简单的:仅控制Y轴坐标

_root.onEnterFrame = function(){
 if(_root._ymouse>609 and _root._ymouse<660){
  stop();
 }
 else{
  play();
 }

}

复杂的:控制和判断X轴和Y轴坐标

_root.onEnterFrame = function(){
 if(_root._ymouse>0 and _root._ymouse<424){
  myVar=false;
 }
 if(_root._ymouse>425 and _root._ymouse<500){
  myVar=true;
 }
 if(_root._xmouse>0 and _root._xmouse<30 and myVar==true){
  imgBar.prevFrame();
  imgBar.prevFrame();
  imgBar.prevFrame();
 }else{imgBar.play();}
 if(_root._xmouse>30 and _root._xmouse<60 and myVar==true){
  imgBar.prevFrame();
  imgBar.prevFrame();
 }
 if(_root._xmouse>60 and _root._xmouse<125 and myVar==true){
  imgBar.prevFrame();
 }
 if(_root._xmouse>125 and _root._xmouse<475 and myVar==true){
  imgBar.stop();
 }
 if(_root._xmouse>475 and _root._xmouse<540 and myVar==true){
  imgBar.nextFrame();
 }
 if(_root._xmouse>540 and _root._xmouse<570 and myVar==true){
  imgBar.nextFrame();
  imgBar.nextFrame();
 }
 if(_root._xmouse>570 and _root._xmouse<600 and myVar==true){
  imgBar.nextFrame();
  imgBar.nextFrame();
  imgBar.nextFrame();
 }
}