开发者

deep copy or clone of a UIComponent

开发者 https://www.devze.com 2023-02-27 08:35 出处:网络
I tried this: registerClassAlias(\"mx.core.UIComponent\",UIComponent); var ob:UIComponent= UIComponent(ObjectUtil.copy(flexUI));//where flexUI is source UIComponent

I tried this:

registerClassAlias("mx.core.UIComponent",UIComponent);
var ob:UIComponent= UIComponent(ObjectUtil.copy(flexUI));//where flexUI is source UIComponent 

But it did not work. returning me null in ob

I also tried:

var canvas:Canvas = new canvas();
canvas.createComponentFromDescriptor(flexUI.descriptor,false);

Any help in resolving this would be appr开发者_开发问答eciated. Thanks guys.


var canvas:Canvas = new canvas();
canvas.createComponentFromDescriptor(flexUI.descriptor,false);
canvas.validateNow();


AFAIK, you can't clone DisplayObject. Your best bet is recreate it with same parameters, for example, have a custom class for it, create new instance and feed same data into it.

0

精彩评论

暂无评论...
验证码 换一张
取 消