Flash类的运用:可放大、缩小、旋转的鼠标操作类
作者 佚名技术
来源 服务器技术
浏览
发布时间 2012-07-07
fsetTem return0 } if(rBorder.height-numOffsetTem<r.height){ currentOp.height=rBorder.height-numOffsetTem return0 } //trace(currentOp); if(r.x<rBorder.x){ opObject.RegPoint(currentOp,currentOp.globalToLocal(pCent)); no(); currentOp.x=rBorder.x+r.width/2; } if(r.y<rBorder.y){ opObject.RegPoint(currentOp,currentOp.globalToLocal(pCent)); no(); currentOp.y=rBorder.y+r.height/2; } if(r.x+r.width>rBorder.x+rBorder.width){ opObject.RegPoint(currentOp,currentOp.globalToLocal(pCent)); no(); currentOp.x=rBorder.x+rBorder.width-r.width/2; } if(r.y+r.height>rBorder.y+rBorder.height){ opObject.RegPoint(currentOp,currentOp.globalToLocal(pCent)); no(); currentOp.y=rBorder.y+rBorder.height-r.height/2; } return0 } //取消的所有动作 publicfunctionno():void{ isDrog=false; clrPoint(); if(spPoint){ spPoint.stopDrag(); } currentOp.stopDrag(); } //重新设置注册点 privatefunctionseCentXY():void{ varpTem:Point; switch(pointType){ case1: pTem=currentOp.globalToLocal(newPoint(arrPoint[4].x,arrPoint[4].y)); break; case2: pTem=currentOp.globalToLocal(newPoint(arrPoint[5].x,arrPoint[5].y)); break; case3: pTem=currentOp.globalToLocal(newPoint(arrPoint[6].x,arrPoint[6].y)); break; case4: pTem=currentOp.globalToLocal(newPoint(arrPoint[7].x,arrPoint[7].y)); break; case5: pTem=currentOp.globalToLocal(newPoint(arrPoint[0].x,arrPoint[0].y)); break; case6: pTem=currentOp.globalToLocal(newPoint(arrPoint[1].x,arrPoint[1].y)); break; case7: pTem=currentOp.globalToLocal(newPoint(arrPoint[2].x,arrPoint[2].y)); break; case8: pTem=currentOp.globalToLocal(newPoint(arrPoint[3].x,arrPoint[3].y)); break; } opObject.RegPoint(currentOp,pTem); } privatefunctionfun_point_down(e:MouseEvent):void{ // varspTem:Sprite=e.targetasSprite; spPoint=spTem; if(spRotationPoint==spPoint){ vardx:Number=currentOp.parent.mouseX-pCent.x; vardy:Number=currentOp.parent.mouseY-pCent.y; nowRotation-=(Math.atan2(dy,dx)*180/Math.PI); varpTem:Point=currentOp.globalToLocal(pCent); opObject.RegPoint(currentOp,pTem); spTem.alpha=0; clrPointSize(); }else{ pointType=0; for(vari:uint=0;i<arrPoint.length;i++){ if(arrPoint[i]==spTem){ pointType=i+1; break; } } seCentXY(); } isDrog=true; spTem.startDrag(true); } privatefunctionfun_point_up(e:MouseEvent):void{ nowRotation=currentOp.rotation; clrPoint(); } privatefunctionisUpObj(sp:Sprite):Boolean{ varisRe:Boolean=false; if(currentOp==sp){ isRe=true; }else{ for(vari:uint=0;i<arrPoint.length;i++){ if(arrPoint[i]==sp){ isRe=true; break; } } // if(spRotationPoint==sp){ isRe=true; } } returnisRe; } publicfunctionfun_Mouse_up(e:MouseEvent):void{ isDrog=false; if(!isUpObj(e.targetasSprite)){ clrPoint(); }else{ if(spPoint){ spPoint.stopDrag(); } } } publicfunctionfun_onEnterFrame(e:Event):Boolean{ if(isDrogOp){ showOp4point(currentOp); } if(!isDrog){ returnfalse; } varspTem:Sprite=spPoint; vardx:Number,dy:Number; //旋转 if(spRotationPoint==spPoint){ dx=currentOp.parent.mouseX-pCent.x; dy=currentOp.parent.mouseY-pCent.y; currentOp.rotation=(Math.atan2(dy,dx)*180/Math.PI)+n |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于Flash类的运用:可放大、缩小、旋转的鼠标操作类的所有评论