Monday, 19 September 2011

Restrict Popup Window Move


public function restrictPopUpMove(event:MoveEvent):void
{
var window:UIComponent = this ;
var mainWindowArg:DisplayObjectContainer = Application.application as DisplayObjectContainer;

if ((window.x + window.width) > mainWindowArg.width)
window.x = mainWindowArg.width - window.width;

if((window.y + window.height) > mainWindowArg.height)
window.y = mainWindowArg.height - window.height;

if(window.x < 0)
window.x = 0;

if(window.y < 0)
window.y = 0;

window.move(window.x, window.y);
}

No comments:

Post a Comment