Return to Snippet

Revision: 41067
at February 11, 2011 10:19 by CammoKing

Initial Code

function startDragHiRes(e:Event):void {
    var hiResWidth =;
    var hiResHeight =;
    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);

Initial URL

Initial Description
This function will keep an image that is larger than the stage dragging within the stage view, stopping at any edge of the image.

Initial Title
Keep Larger Image or Object draggable within stage - Actionscript

Initial Tags

Initial Language
ActionScript 3