Flex 와 TitleWindow 통신 사례 및 itemRender 와 부모 구성 요소 의 통신

4955 단어 xmlFlexFlashAdobe
http://www.pqshow.com/design/jiqiao/200912/12573.html
 
flex itemRender 와 부모 구성 요소 의 통신
 
this.parentDocument.reset();//      

<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%">
    <mx:Script>
        <![CDATA[
            private function RequestData():void
            {                                
                this.parentDocument.reset();//      
                var numStartDate:Number = -1;
                numStartDate = data.numStartDate;
                var numEndDate:Number = -1;        
                numEndDate = data.numEndDate;        
                var obj:Object = new Object();
                obj.token = data.nickName;                
                obj.startDate = numStartDate;
                obj.endDate = numEndDate;
                var requestCurrentPage:Number = HYAgentStaticsSelfModel.getInstance().currentPage    ;    
                obj.pageNo = requestCurrentPage + 1;                
                obj.pageSize = lengthOfpage * pageRequestCount;            
                EventBroadcaster.getInstance().broadcastEvent("EVENT_AGENTSTATICSSELF",obj);
            }    
        
        ]]>
    </mx:Script>
    <mx:LinkButton label="{data.nickName}" click="refeshData();"/>
</mx:HBox>
 
 
main.mxml
 
 
<?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:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<fx:Script>
		<![CDATA[
		import flash.events.*;
		import mx.managers.PopUpManager;
		import mx.containers.TitleWindow;    
		
		//         ,  myTitleWindow   
		private function openWindow(event:MouseEvent):void {
		//   PopUpManager.createPopUp    myTitleWindow
		var aTitleWindow:MyTitleWindow=MyTitleWindow(PopUpManager.createPopUp(this,MyTitleWindow, true));
		PopUpManager.centerPopUp(aTitleWindow); //  
		//            myObj         MXML  
		aTitleWindow.myObj = this;
		}
		]]>
	</fx:Script>
	<s:Button label="     " click="openWindow(event);" x="404" y="24"/>
	<s:Label id="myLabel" text="wait..." width="200" x="375" y="110" fontWeight="bold" fontSize="18" color="#06C9F3"/>
</s:Application>

 MyTitleWindow.mxml
 
<?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="PopUpManager.removePopUp(this);">
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<s:TextInput x="10" y="10" id="myTextInput"/>
	<s:Button x="36" y="74" label="  " id="myButton"
			   click="closeTitleWindow(event);"/>
	<fx:Script>
		<![CDATA[       
		import mx.managers.PopUpManager;
		import mx.controls.Text;
		
		//                   
		public var myObj:Object;
		
		//           TitleWindow   .
		private function closeTitleWindow(event:MouseEvent):void {
		myObj.myLabel.text = "     :" + myTextInput.text;
		myObj.myLabel.setStyle("color",String(cp.selectedColor))
		PopUpManager.removePopUp(this);
		}
		
		private function close(evt:MouseEvent):void{
		
		PopUpManager.removePopUp(this);
		} 
		]]>
	</fx:Script> 
	<s:Button x="96" y="74" label="close" click="close(event);"/>
	<mx:ColorPicker x="10" y="44" id="cp" selectedColor="#F30A0A"/>
</s:TitleWindow>

좋은 웹페이지 즐겨찾기