【问题标题】:How can i set visible="true" attribute to the Panel from other component?如何从其他组件为 Panel 设置 visible="true" 属性?
【发布时间】:2010-12-26 10:38:00
【问题描述】:

我的代码是:

"
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 文件中

xml 版本="1.0" 编码="utf-8"?>

在 goBack() 事件中我想禁用具有 id="main" 的面板

请告诉我解决方案......

【问题讨论】:

    标签: apache-flex


    【解决方案1】:

    你也可以像这样给自定义组件添加一个id,

    <custom:AddressForm  id="myCustomComponent">
    
      </custom:AddressForm>
    

    并访问可以设置可见性的控件,

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

    【讨论】:

      【解决方案2】:
      public function goBack(e:Event):void{
          e.currentTarget.parent.parent.visible = false;
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-06-03
        • 1970-01-01
        • 2016-09-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多