1

我想从Main.mxml(主应用程序)更改自定义组件弹出窗口的属性我的自定义组件是 ->

public class PropertyPanel extends Panel
.....

在里面我有

public function minimisePanel(e:MouseEvent):void{

            effResize.heightTo = previousHeight;
            effResize.widthTo = 200;
            this.x = parentApplication.width - 320;
            effResize.play([this]);
        }

在主应用程序中,我将其称为 -->

private function AddPropertiesPanel():void{
    var PropWindow:IFlexDisplayObject;
    PropWindow =    PopUpManager.createPopUp(this, Property_Panel, false);
    /*Property_Panel is Property_Panel.mxml*/
}

在主要应用程序中我想 -->

public function setCurrObj(event:TransformEvent):void{
/*Some Magical Stuff Required Here*/
}
4

1 回答 1

1

而不是将弹出窗口存储为函数本地的变量;将其作为实例变量存储在 Main.mxml 类中:

public var PropWindow:IFlexDisplayObject;

AddPropertiesPanel() 方法将改变如下:

private function AddPropertiesPanel():void{
    PropWindow =    PopUpManager.createPopUp(this, Property_Panel, false);
    /*Property_Panel is Property_Panel.mxml*/
}

然后您可以通过其他方法轻松访问面板实例上的属性:

public function setCurrObj(event:TransformEvent):void{
 PropWindow.someProperty = someValue
}
于 2013-11-12T10:40:23.780 回答