<!-- lang: as3 -->
<?xml version="1.0" encoding="utf-8"?>
<s:HGroup xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" mouseDown="drogWin(event)" mouseUp="drogWin(event)" width="100%">
<s:Label text="{_title}" width="100%" fontSize="13" fontWeight="bold" paddingLeft="10" paddingTop="3"/>
<mx:Image width="16" height="16" source="{Resource.ICON_CLOSED}" buttonMode="true"
visible="{_showClose}" includeInLayout="{_showClose}" click="_close.call()"/>
<fx:Script>
<![CDATA[
import com.maphao.part.ascript.Resource;
[Bindable]
private var _title:String = "标题";
[Bindable]
private var _showClose:Boolean = true;
private var _window:Sprite;
private var _close:Function = null;
public function set title(value:String):void{
this._title = value;
}
public function set window(value:Sprite):void{
this._window = value;
}
public function set close(value:Function):void{
this._close = value;
}
public function set showClose(value:Boolean):void{
this._showClose = value;
}
public function get showClose():Boolean{
return this._showClose;
}
//拖动
private var upPoint:Point = new Point();
private var downPoint:Point = new Point();
private function drogWin(evt:MouseEvent):void {
switch (evt.type) {
case "mouseDown" :
downPoint = new Point(mouseX,mouseY);
_window.startDrag();
break;
case "mouseUp" :
upPoint = new Point(mouseX,mouseY);
_window.stopDrag();
break;
default:
break;
}
}
]]>
</fx:Script>
</s:HGroup>