flex4 titlewindow接收从父类页面传过来的值

flex应用程序:

 

<?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">
	
	
	
	<fx:Script>
		<![CDATA[
			import com.model.titleWindow;
			
			import mx.collections.ArrayCollection;
			import mx.core.FlexGlobals;
			import mx.managers.PopUpManager;
			
			public  var titleWindows:titleWindow  ;
			protected function button1_clickHandler(event:MouseEvent):void
			{
				/* if(titleWindows.visible){
					PopUpManager.removePopUp(titleWindows);
				} */
				var doctypes:ArrayCollection=new ArrayCollection(["*.as","*.mxml","*.swc"]);
				titleWindows = titleWindow(PopUpManager.createPopUp(this,titleWindow,true));
				
				/* titleWindows.addEventListener("close", removeMe); */
				/* titleWindows["cancelButton"].addEventListener("click", removeMe);   */ 
				/* titleWindows["okButton"].addEventListener("click", submitData);    */
				
				/* titleWindows.owner = this;	
				PopUpManager.addPopUp(titleWindows,this,true);
				PopUpManager.centerPopUp(titleWindows); */
				titleWindows.myArray=doctypes;
				/* 
				var test:titleWindow  =  titleWindow(PopUpManager.createPopUp(this,titleWindow,true,null)); */
				titleWindows.x=FlexGlobals.topLevelApplication.stage.stageWidth/2-titleWindows.width/2;  
				titleWindows.y=FlexGlobals.topLevelApplication.stage.stageHeight/2-titleWindows.height/2; 
			}
			/* private function submitData(event:Event):void {
				ti1.text = String(titleWindows.cb1.selectedItem);
				//removeMe();
				PopUpManager.removePopUp(titleWindows);
			} */
			
			// Cancel button click event listener.
			private function removeMe(event:Event):void {
				PopUpManager.removePopUp(titleWindows);
			}           
		]]>
	</fx:Script>
	
	<s:Button x="243" y="223" label="点击弹出" click="button1_clickHandler(event)"/>
	<s:TextInput x="219" y="80" id="user"/>
	<s:TextInput x="219" y="137" id="pass"/>
	<s:TextInput x="488" y="163" id="ti1"/>
</s:Application>  	
titlewindow模块:
<?xml version="1.0" encoding="utf-8"?>
<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300"
			   close="titlewindow1_closeHandler(event)">
	<fx:Script>
		<![CDATA[
			import mx.collections.ArrayCollection;
			import mx.events.CloseEvent;
			import mx.events.FlexEvent;
			import mx.managers.PopUpManager;
			
			protected function titlewindow1_closeHandler(event:CloseEvent):void
			{
				// TODO Auto-generated method stub
				PopUpManager.removePopUp(this);   
			}
			
			protected function tw_click():void
			{
				var test:taecsMouble  = this.owner as taecsMouble ;
				test.user.text = this.user.text;
				test.pass.text =  this.pass.text;
			}
			
			[Bindable]
			public var myArray:ArrayCollection;
		]]>
	</fx:Script>
	<fx:Declarations>
		<!-- 将非可视元素(例如服务、值对象)放在此处 -->
	</fx:Declarations>
	<s:TextInput x="146" y="94" id="user"/>
	<s:TextInput x="151" y="139" id="pass"/>
	<s:Button x="209" y="199" label="按钮" click="tw_click()"/>
	<s:DropDownList x="62" y="186" dataProvider="{myArray}"></s:DropDownList>
</s:TitleWindow>
 
 

你可能感兴趣的:(window)