In my application, I have a chart that I want to display in a TitleWindow when clicked on.
var win:TitleWindow = PopUpManager.createPopUp(this, TitleWindow, false) as TitleWindow;
win.addChild(myChart);
PopUpManager.bringToFront(win);
It does indeed place the chart in the titlewindow that shows up, but it removes the original chart from the parent. Then, when the titlewindow is closed, my chart is simply gone. I can't figure out how to clone the chart -- all the methods I've tried failed -- and I have no idea why this is happening.
Solution:
public var barChart:BarChart;
public function onClick(e:Object):void
{
barChart = (e as BarChart);
if(barChart != null)
{
var win:MyWindow = PopUpManager.createPopUp(this, MyWindow, false) as MyWindow;
PopUpManager.centerPopUp(win);
}
}
// ... MyWindow.mxml ...
var _parent:Object;
private function creationComplete(e:Event):void
{
bChart = parentApplication.barChart;
_parent = bChart.parent;
this.addChild(bChart);
}
private function onMyWindowClose(evt:CloseEvent):void {
_parent.addChild(bChart);
PopUpManager.removePopUp(this);
}