0
votes

My code is :

< mx:Application 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>

my code for AddressForm is in another .mxml file

< ? xml version="1.0" encoding="utf-8"?>

< mx:Form xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300" verticalScrollPolicy="off">

< mx:Button label="Back" id="back" click="goBack(event)"/>

< /mx:Form>

on goBack() event i want to disable the Panel having id="main"

plese tell me the solution ......

2

2 Answers

0
votes
public function goBack(e:Event):void{
    e.currentTarget.parent.parent.visible = false;
}
2
votes

You can also add an id to the custom component like this,

<custom:AddressForm  id="myCustomComponent">

  </custom:AddressForm>

and access the control whose visibility can be set,

public function goBack(e:Event):void{
    myCustomComponent.main.visible = false;
}