我在我的应用程序中有一个VGroup
,其中包含MyComponent
类型的几个自定义组件。现在我在MyComponent
中有一个删除方法,它应该从VGroup
中删除元素。我知道我应该使用parentDocument.vgroupId.removeElement()
,但是要传递什么作为参考?Flex:删除可视元素
注:我想从MyComponent
UPDATE做的方法中删除:这里是我的源: 在我的主要应用
<s:VGroup id="vgroupId" width="100%" height="100%" />
现在添加我的自定义组件:
var cust:FunctionElement = new MyComponent(); // MyComponent extends spark Panel
vgroupId.addElement(cust);
而从MyComponent
我打电话给
parentDocument.vgroupId.removeElement(this) // get this error => TypeError: Error #1034: Type Coercion failed: cannot convert [email protected] to mx.core.IVisualElement.
如果我投它作为this as IVisualElement
我得到一个错误,它等于null
我只注意到你正在添加MyComponent作为FunctionElement ..为什么? – ocodo 2010-09-06 01:24:02