Flex親子ウィンドウのデータ交換


Flexにおける親ウィンドウと子ウィンドウのデータ交換の実現は以下の通りである.
1 Flex 2のポップアップウィンドウのAPIは以下の通りです.
Package :  mx.managers
Class   :        PopUpManager
Methods : addPopUp(window:IFlexDisplayObject, parent:DisplayObject, modal:Boolean = false, childList:String = null):void
パラメータの説明:
Windows:ポップアップするオブジェクトは、TitleWindowなどのIFLexDisplayObjectインタフェースを実装する必要があります.
parent:サブウィンドウの親ウィンドウオブジェクト.
modal:モードポップアップ(true)か非モードポップアップ(false)か.
childList:ポップアップオブジェクトがそのオブジェクトの下にポップアップする.
                 PopUpManagerChildList.APPLICATION
                 PopUpManagerChildList.POPUP     
                 PopUpManagerChildList.PARENT(デフォルト).
2例

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%">
<mx:Script>
<![CDATA[
import mx.events.ListEvent;
import com.demo.PersonVO;
import mx.events.ItemClickEvent;
import mx.collections.ArrayCollection;
import mx.managers.PopUpManager;
[Bindable]
private var testDataSource : ArrayCollection = new ArrayCollection(
[      {id : 1 ,name :"zhangsan",language : "java"},
       {id : 2 ,name :"lisi",language : "c++"},
       {id : 3 ,name :"qianwu",language : "vb"},
       {id : 4 ,name :"xiaohong",language : "pb"},
       {id : 5 ,name :"xiaoming",language : "perl"},
])

private function showDetailPersonInfo(event : ListEvent) : void
{
       var personVO : PersonVO =new PersonVO();
  
       personVO.id = event.currentTarget.selectedItem.id
       personVO.name = event.currentTarget.selectedItem.name;
       personVO.language = event.currentTarget.selectedItem.language;
  
       //hard code the detail person information
       personVO.email = "[email protected]"
       personVO.married = false;
       personVO.workYears = "3 years"
  
       var personPopUpWindow : PersonInfomationPopWindow = new PersonInfomationPopWindow();
       personPopUpWindow.personVO = personVO;
       PopUpManager.addPopUp(personPopUpWindow,this,true);
       PopUpManager.centerPopUp(personPopUpWindow);
}

]]>
</mx:Script>
<mx:DataGrid dataProvider="{testDataSource}" width="100%" height="100%" itemClick="showDetailPersonInfo(event)">
<mx:columns>
       <mx:DataGridColumn dataField="id" headerText="  " />
       <mx:DataGridColumn dataField="name" headerText="  " />
       <mx:DataGridColumn dataField="language" headerText="    " />
</mx:columns>
</mx:DataGrid>
</mx:Application>
------------------------------
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow 
xmlns:mx="http://www.adobe.com/2006/mxml" 
width="400" 
height="300" 
showCloseButton="true" 
close="PopUpManager.removePopUp(this)">
<mx:VBox width="400" height="200" paddingTop="10" >
      <mx:HBox width="100%" paddingLeft="10">
       <mx:Label width="40%" text="id:"/>
       <mx:Label text="{personVO.id}"/>  
      </mx:HBox>   
      <mx:HBox width="100%" paddingLeft="10">
       <mx:Label width="40%" text="name:"/>
       <mx:Label text="{personVO.name}"/>  
      </mx:HBox>
      <mx:HBox width="100%" paddingLeft="10">
       <mx:Label width="40%" text="language:"/>
       <mx:Label text="{personVO.language}"/> 
      </mx:HBox>
      <mx:HBox width="100%" paddingLeft="10">
       <mx:Label width="40%" text="workYears:"/>
       <mx:Label text="{personVO.workYears}"/> 
      </mx:HBox>
      <mx:HBox width="100%" paddingLeft="10">
       <mx:Label width="40%" text="married:"/>
       <mx:Label text="{personVO.married}"/> 
      </mx:HBox>
</mx:VBox>
<mx:Script>
      <![CDATA[
       import mx.managers.PopUpManager;
       import com.demo.PersonVO;
       [Bindable]
       public var personVO : PersonVO = null;]]>
</mx:Script>
</mx:TitleWindow>
-------------------------------------------
package com.demo
{
[Bindable]
public class PersonVO
{
  
      public var id : String = "";
      public var name : String = "";
      public var language : String = "";
      public var email : String = "";
      public var workYears : String = "";
      public var married : Boolean = false;
  
  
}
}