我想更改自定义组件弹出的属性来自 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*/
}
答案 0 :(得分: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
}