FLASH中鼠標(biāo)移動到一定區(qū)域停止播放動畫代碼
FLASH中鼠標(biāo)移動到一定區(qū)域停止播放動畫代碼:
簡單的:僅控制Y軸坐標(biāo)
_root.onEnterFrame = function(){
if(_root._ymouse>609 and _root._ymouse<660){
stop();
}
else{
play();
}
}
復(fù)雜的:控制和判斷X軸和Y軸坐標(biāo)
_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();
}
}