我的代码是:
< mx:应用程序xmlns:mx =“http://www.adobe.com/2006/mxml”xmlns:rest =“com.sourcestream.flex.http。”
xmlns:custom =“Components。”initialize =“loadProduct()”
>
<mx:Panel id="main" >
</mx:Panel>
<mx:Panel id="addressId" visible="false" >
<custom:AddressForm >
</custom:AddressForm>
</mx:Panel>
我的AddressForm代码在另一个.mxml文件中
&LT; ? xml version =“1.0”encoding =“utf-8”?&gt;
&LT; mx:表格xmlns:mx =“http://www.adobe.com/2006/mxml”width =“400”height =“300”verticalScrollPolicy =“off”&gt;
&LT; mx:Button label =“Back”id =“back”click =“goBack(event)”/&gt;
&LT; / MX:表&GT;
在goBack()事件中我想禁用具有id =“main”
的Panel 请告诉我解决方案......答案 0 :(得分:2)
您还可以像这样添加自定义组件的ID
<custom:AddressForm id="myCustomComponent">
</custom:AddressForm>
并访问可以设置其可见性的控件
public function goBack(e:Event):void{
myCustomComponent.main.visible = false;
}
答案 1 :(得分:0)
public function goBack(e:Event):void{
e.currentTarget.parent.parent.visible = false;
}