1 Reply Latest reply on Nov 2, 2009 5:58 AM by jake_flex

    Return control back to main mxml from Pop Up

    appdevs Level 1

      I have a main mxml from which I call a Pop Up window which allows a user to enter a date and click on a button.The issue is that the control doesnt come back to the main mxml after that.

       

      main.mxml - When I click on an item in the mxml , a Pop Up window should come up.After clicking the Compare button in Pop Up window, the control should return back to main mxml and a function called as "compareWithGoldServer" should execute.

       

      [

      Bindable] public var comparisonDate:Date;

      var note:ComparisonData = new ComparisonData();

      PopUpManager.addPopUp(note,

      this, true);

      PopUpManager.centerPopUp(note);

      comparisonDate = note.comparisonDate;

       

      compareWithGoldServer(comparisonDate);

       

       

       

      ComparisonData.mxml  - User selects a Date and clicks on Compare button -

       

      [

      Bindable] public var comparisonDate:Date;

      private

       

      function getComparisonResults():void {

           comparisonDate = comparisonDateField.selectedDate;

       

           removeMe();

      }

       

      private function removeMe():void{

           PopUpManager.removePopUp(

      this);

      }

      <mx:DateField id="comparisonDateField" yearNavigationEnabled="true" change="cmpButton.enabled=true" />

      <mx:Button id="cmpButton" label="Compare" click ="getComparisonResults()"/>

       

       

       

      ISSUE: Control doesnt return back to main mxml and the function compareWithGoldServer doesnt get called.

       

       

       

        • 1. Re: Return control back to main mxml from Pop Up
          jake_flex Level 2

          Hi,

           

          The execution of main.mxml doesn't stop when you open the popup. The compareWithGoldServer() function is executed before you close the popup. You'll need to synchronize the calls so that you create an event handler in the main that listens for an event when the popup is closed.

           

          You can achieve this by dispatching some custom event from removeMe() function and create a handler for that in main.mxml.

          1 person found this helpful