在panel的titlebar下放置其他组件
在panel的titlebar上放置其他组件
<?xml version="1.0" encoding="utf-8"?> <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="init();" removedEffect="Fade" styleName="popUpPanel" borderColor="#5C5C5C" width="150" height="150"> <mx:Script> <![CDATA[ import mx.controls.LinkButton; import mx.controls.Button; import mx.containers.HBox; import mx.controls.Image; import mx.managers.PopUpManager; import mx.controls.Alert; [Embed(source="add.jpg")] private var addIcon:Class; private function init():void{ var button:LinkButton = new LinkButton(); button.setStyle("icon",addIcon); // button.height=16; button.addEventListener(MouseEvent.CLICK, buttonClick); //Create Hbox to add to title bar var titleHbox:HBox = new HBox(); titleHbox.setStyle("horizontalAlign","center"); titleHbox.width=this.titleBar.width; titleHbox.height=this.titleBar.height; //titleHbox.width=200; //Add image and button to HBox //button.label="add"; //button.width=45; titleHbox.addChild(button); //Add Hbox with button and image titleHbox.label="testadd"; this.titleBar.addChild(titleHbox); //center popup panel } //Function called when button is clicked private function buttonClick(event:Event):void{ Alert.show('Button clicked now closing'); PopUpManager.removePopUp(this); } ]]> </mx:Script> </mx:Panel>