当前位置: 代码迷 >> Web前端 >> 统制titlewindow的移动范围不让超过应用程序宽度
  详细解决方案

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

热度:74   发布时间:2012-09-02 21:00:34.0
控制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;
?? ?}
?? ?
}

  相关解决方案