Need to create TitleWindow using PopUpManager to close TitleWindow using PopUpManager

568
8
10-06-2010 12:59 PM
PeteVitt
Occasional Contributor III
I've got a TitleWindow that is populated with a chart.  I'm trying to get the TitleWindow to close using the close event and the popupmanager as shown below.  The event fires but the TitleWindow wont close -- I have the Title Window hard coded -- does it need to be created in script using the popup manager in order for the window to close? or hopefully something else I'm missing?

Thanks

...

<s:TitleWindow id="myTW"
title="Maximum Groundwater Elevation"
visible="false"
close="closeWindow();">
 
.... chart stuff ...
 
<fx:Script>
<![CDATA[
import mx.managers.PopUpManager;

  public function closeWindow():void
    {
     PopUpManager.removePopUp(this.myTW); //also tried this only

    }
   ]]>

  </fx:Script>


</s:TitleWindow>
....
Tags (2)
0 Kudos
8 Replies
RobertScheitlin__GISP
MVP Emeritus
Pete,

   Is the TitleWindow the top level object/component? If so than the code you have works for me all the time.
0 Kudos
PeteVitt
Occasional Contributor III
Robert - it is one of two titlewindows nested inside a border container:

<bordercontainer>
 
  <titlewindow>
  </titlewindow>
  <titlewindow>
    titlewindow trying to close
  </titlewindow>


</bordercontainer>
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Pete,

   So what is the actual item being popuped then?
0 Kudos
PeteVitt
Occasional Contributor III
the TitleWindow I'm trying to close is invisible until a button is clicked.  The other window (containing the map) is always visible
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Pete,

   What does your code using the popupmanager look like for bringing up the title window then?
0 Kudos
PeteVitt
Occasional Contributor III
It is set visible after a query is executed:

public function displayBarChart(infos:ArrayCollection):void
   {
    myChart.dataProvider=infos;
    myTW.visible=true;
   }
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Pete,

    You can not use popupmanager to close a titlewindow if you never actually used popupmanager to open the titlewindow.
0 Kudos
PeteVitt
Occasional Contributor III
Ok, thanks Robert.  I figured this might be the case, but was hoping it wasnt -- seems like you should be able to close a window without all this fuss
0 Kudos