在stage-Actionscript中保持较大的图像或对象可拖动
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在stage-Actionscript中保持较大的图像或对象可拖动相关的知识,希望对你有一定的参考价值。
This function will keep an image that is larger than the stage dragging within the stage view, stopping at any edge of the image.
hiResSprite.addEventListener(MouseEvent.MOUSE_DOWN,startDragHiRes); function startDragHiRes(e:Event):void { var hiResWidth = e.target.width; var hiResHeight = e.target.height; var stageWidthVal = stage.stageWidth; var stageHeightVal = stage.stageHeight; var hiResX = hiResWidth - stageWidthVal; var hiResY = hiResHeight - stageHeightVal; var dragWidth = hiResWidth - stageWidthVal; var dragHeight = hiResHeight - stageHeightVal; var hiResDragRect = new Rectangle(-hiResX,-hiResY,dragWidth,dragHeight); hiResSprite.startDrag(false,hiResDragRect); }
以上是关于在stage-Actionscript中保持较大的图像或对象可拖动的主要内容,如果未能解决你的问题,请参考以下文章