首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

统制titlewindow的移动范围不让超过应用程序宽度

2012-09-02 
控制titlewindow的移动范围不让超过应用程序宽度1.添加WINDOW_MOVE事件,snapshotTool为myTool为窗体对象my

控制titlewindow的移动范围不让超过应用程序宽度

1.添加WINDOW_MOVE事件,snapshotTool为myTool为窗体对象

myTool.addEventListener(TitleWindowBoundsEvent.WINDOW_MOVE,myMoveHandler);

2.

?? private function myMoveHandler(event:TitleWindowBoundsEvent):void
{
?? ?var currTarget:MyTool = event.currentTarget as MyTool ;
?? ?var x:Number = currTarget.x;
?? ?var y:Number = currTarget.y;

?? ?if (y >= this.parentApplication.height - 20)
?? ?{
?? ??? ?currTarget.y=this.parentApplication.height - 20;
?? ?}

?? ?if (y <= 0)
?? ?{
?? ??? ?currTarget.y=0;
?? ?}

?? ?if (x >= this.parentApplication.width - currTarget.width)
?? ?{
?? ??? ?currTarget.x=(this.parentApplication.width - currTarget.width);
?? ?}

?? ?if (x <= 0)
?? ?{
?? ??? ?currTarget.x=0;
?? ?}
?? ?
}

热点排行