1
Canvas에서 다른 Canvas로 동적으로 추가 한 UIComponents를 복제 할 때 문제가 있습니다.Canvas에서 동적으로 추가 된 UIComponents를 복제하는 방법
이 예제를 따르지만이 시나리오에서는 childDescriptors가 null이되므로 동적으로 추가 된 구성 요소에는 작동하지 않습니다.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal">
<mx: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();
}
]]>
</mx: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>
</mx:Application>