开发者

How can i set visible="true" attribute to the Panel from other component?

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"

pl开发者_JAVA百科ese tell me the solution ......


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;
}


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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜