Flex Alert
<?xml version="1.0"?>
<!-- Simple example to demonstrate the Alert control. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.CloseEvent;
// Event handler function uses a static method to show
// a pop-up window with the title, message, and requested buttons.
private function clickHandler(event:Event):void {
Alert.show("Do you want to save your changes?", "Save Changes", 3, this, alertClickHandler);
}
// Event handler function for displaying the selected Alert button.
private function alertClickHandler(event:CloseEvent):void {
 
相关文档:
了解Flex程序的生命周期
Flex程序从本质上讲,就是使用了(由AS编写的)Flex框架的Flash程序。
但在Flex程序中可以忽略timeline这个概念,所有的内容都集于一帧。
事实上Flex程序中的根,是继承flash.display.MovieClip的mx.managers.SystemManager。
SystemManager有两帧。第一帧是预加载程序,第二帧是主程序。
因此 ......
1.如果使用MVC框架,相信这并不是一个问题。而如果没有使用的话,可以用类似的方法设置一个单例,子窗口和父窗口通过这个单例来交互消息,如果需要解耦,请发送自定义事件。总之,只要按照MVC思路来做就可以了。
2.类似JS,在子窗口的构造函数里增加一个参数,将父窗口传参进去。MXML没有构造函数,用一个属性来保存父窗 ......
as:
var app:Object;
function setApp(ap:Object):void{
this.app=ap;
}
btn.addEventListener(MouseEvent.CLICK,onClick);
function onClick(event:MouseEvent):void{
app.fun(btn.label);
}
flex:
private function onSwfLoaded(event:Event):void
{
myloader.addEventListen ......
<mx:DataGrid id="dg" click="select()" dataProvider= "{modelLocator.resultList}" borderStyle="none"
verticalGridLines="false" horizontalGridLines="false" verticalScrollPolicy="off" rowCount="10"
fontSize="16" fontStyle="normal" fontThickness="0" width="100%" height="100%">
<mx:columns& ......