`

MX Tree Control 事件

阅读更多
获取树控件的节点打开,选择的事件
<?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" >  
	
	<!-- ====== Properties of parent ======================= -->  
	<s:layout>
		<s:BasicLayout/>
	</s:layout>   
	
	<!-- ====== MetaData =================================== -->  
	
	<!-- ====== Styles ===================================== -->  
	
	<!-- ====== Script ===================================== -->  
	<fx:Script>
		<![CDATA[
			import flash.events.*;
			
			import mx.controls.*;
			import mx.events.*;
			
			protected function tree1_itemOpenHandler(event:TreeEvent):void
			{
				forOpen.text = event.item.@label
			}


			protected function tree1_changeHandler(event:ListEvent):void
			{
				var theData:String = ""
				if (event.currentTarget.selectedItem.@data) {
					theData = " Data: " + event.currentTarget.selectedItem.@data;
				}
				forChange.text = event.currentTarget.selectedItem.@label + theData;
			}
 
			protected function tree1_creationCompleteHandler(event:FlexEvent):void
			{
				tree1.expandItem(MailBox.getItemAt(0), true);
				forOpen.text=tree1.openItems[0].@label;
			}

		]]>
	</fx:Script>
	
	<!-- ====== Declarations =============================== -->  
	<fx:Declarations>
		<!-- 将非可视元素(例如服务、值对象)放在此处 -->
	</fx:Declarations>   
	
	<!-- ====== UI Components ============================== -->     
	<mx:Tree id="tree1"
			 labelField="@label"
			 showRoot="true"
			 width="160" x="16" y="99"
			 itemOpen="tree1_itemOpenHandler(event)"
			 change="tree1_changeHandler(event)" 
			 creationComplete="tree1_creationCompleteHandler(event)">
		<mx:XMLListCollection id="MailBox">
			<fx:XMLList>
				<node label="Mail" data="100">
					<node label="Inbox" data="70"/>
					<node label="Personal Folder" data="10">
						<node label="Business" data="2"/>
						<node label="Demo" data="3"/>
						<node label="Personal" data="0" isBranch="true" />
						<node label="Saved Mail" data="5" />
					</node>
					<node label="Sent" data="15"/>
					<node label="Trash" data="5"/>
				</node>
			</fx:XMLList>
		</mx:XMLListCollection>
	</mx:Tree>
	
	<mx:Form>
		<mx:FormItem label="Change Event:">
			<mx:Label id="forChange" width="150"/>
		</mx:FormItem>
		<mx:FormItem label="Open Event:">
			<mx:Label id="forOpen" width="150"/>
		</mx:FormItem>
	</mx:Form>
</s:Application>
0
0
分享到:
评论

相关推荐

    How to enable PCIE internal Clock on i.MX8QXP.pdf

    1. **SCFW(Secure Control Firmware)**:这是NXP的安全控制固件,用于管理平台的硬件安全特性。默认情况下,SCFW配置为使用外部时钟。在代码段中,`board_get_pcie_clk_src()` 函数返回 `BOARD_PCIE_PLL_EXTERNAL`...

    imx-mkimage-yocto--rel_imx_4.14.98_2.0.0_ga.tar.gz

    它能够处理多种不同的固件部分,比如设备树(Device Tree)、内核映像(Kernel Image)、根文件系统等,确保这些组件能够正确地加载到目标硬件上。在描述中提到的`scfw_tcm.bin`可能是指System Control Firmware ...

    04_在100ASK_IMX6ULL上机实验1

    Pinctrl(Pin Control)子节点用于定义处理器引脚的功能配置,包括但不限于引脚的复用功能、驱动能力、上拉或下拉电阻等属性。在设备树中,Pinctrl 子节点通常用于指定某个或某些引脚在特定状态下的配置。 #### 2.3...

    Developing Flex Applications 910p dda_doc88_cracker.zip

    DateField control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 HRule and VRule controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....

    ICS delphixe10源码版

    option to restore this directory tree or you will have problems because the files would not be in their proper subdirectories. Please note most of these directories are differently named to ICS V7 ...

Global site tag (gtag.js) - Google Analytics