论坛首页 Web前端技术论坛

flex clone UIComponent (just4flex developer)

浏览 1552 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2011-10-25  
from:http://forums.adobe.com/message/2536270

<?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">
	<s:layout>
		<s:HorizontalLayout />
	</s:layout>
	<fx:Script>
		<![CDATA[
			private function cloneButton_clickHandler (event:MouseEvent):void
			{
				var childDescriptors:Array = original.childDescriptors;
				var descriptorsCount:int = childDescriptors.length;
				for (var i:int; i < descriptorsCount; i++)
				{
					cloned.createComponentFromDescriptor(original.childDescriptors[i],
						false);
				}
				cloned.validateNow();
			}
		]]>
	</fx:Script>
	<mx:Button label="Clone Canvas" click="cloneButton_clickHandler(event);" />
	<mx:Canvas id="original" width="100" height="100" borderStyle="solid" >
		<mx:Label text="Some Label" />
		<mx:ComboBox dataProvider="{['data1', 'data2']}" bottom="0" />
	</mx:Canvas>
	<mx:Canvas id="cloned" width="100" height="100" borderStyle="solid" >
		
	</mx:Canvas>
</s:Application>
论坛首页 Web前端技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics