flex4 弹出框
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<s:layout>
<s:VerticalLayout horizontalAlign="center" verticalAlign="middle" />
</s:layout>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.events.CloseEvent;
import mx.managers.PopUpManager;
import spark.components.TitleWindow;
private var pop:TitleWindow;
private function img1_clickHandler( event:MouseEvent ):void{
pop = TitleWindow( PopUpManager.createPopUp( this, TitleWindow, true )); //创建弹出框
var temp:Image = new Image();
temp.source = event.currentTarget.source;
pop.addElement( temp );//构造弹出框
pop.title = 'Immovble Popup';
pop.isPopUp = true; //是否可以移动
PopUpManager.centerPopUp( pop );//弹出弹出框
pop.addEventListener(CloseEvent.CLOSE, close_handler);
}
private function close_handler( event:CloseEvent ):void{
PopUpManager.removePopUp( pop ); //弹出框消失
}
]]>
</fx:Script>
<s:Label text="Click Image"/>
<mx:Image width="100" height="100" source="assets/tt.jpg" click="img1_clickHandler(event)"/>
</s:Application>