title: pass data from popup to parent
body: <p>I have a parent w/ a popup child. When parent loads, I have to call a function within the popup without showing the popup (thus, I load "pupLove" but don't include it in layout)....I then pass this data to the parent. When the user manually clicks another button to open the popup, the same function is called &amp; data passed to the parent. However, I am not able to pass dg.length to the parent. I believe the root problem is that I am loading "pupLove" &amp; thus the parents are getting confused.....I'm guessing if I get rid of "pupLove" I can pass the data correctly but will need to call the child's function at creationComplete of the parent....how do I do that?</p>
  
  <p>Here's my parent:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
             xmlns:s="library://ns.adobe.com/flex/spark" 
             xmlns:mx="library://ns.adobe.com/flex/mx"
             backgroundColor="green" width="50%" height="100%" 
             xmlns:local="*"         
             &gt;
  
  
  
  &lt;fx:Script&gt;
      &lt;![CDATA[
  
          import pup;
          import mx.managers.PopUpManager;
  
          public function showPup(evt:MouseEvent):void {
              var ttlWndw:pup = PopUpManager.createPopUp(this, pup, true) as pup;
              PopUpManager.centerPopUp(ttlWndw);
          }
  
  
  
      ]]&gt;
  &lt;/fx:Script&gt;
  
  &lt;mx:VBox&gt;
  
  &lt;local:pup id="pupLove" visible="false" includeInLayout="false" /&gt;
  &lt;s:Button click="showPup(event);" label="launch Pup" /&gt;
  &lt;mx:Text id="Ptest" color="black" text="from Parent:{pupLove.dg.length}" /&gt;
  
  &lt;/mx:VBox&gt;
  
  
  &lt;/s:Application&gt;
  </code></pre>
  
  <p>And a popup child called 'pup.mxml':</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" 
       xmlns:s="library://ns.adobe.com/flex/spark" 
       xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300"&gt;
  
  &lt;fx:Script&gt;
      &lt;![CDATA[
  
                      public function init():void{
                      // send php call
                      }
  
          import mx.events.CloseEvent;
          import mx.managers.PopUpManager;
          private function removePup(evt:Event):void {
              PopUpManager.removePopUp(this);
          }
  
      ]]&gt;
  &lt;/fx:Script&gt;
  
  &lt;fx:Declarations&gt;
      &lt;s:ArrayCollection id="dg"&gt;
  
      &lt;/s:ArrayCollection&gt;
  &lt;/fx:Declarations&gt;
  
  
  &lt;s:TitleWindow width="100%" height="100%" close="removePup(event)"&gt;
  &lt;mx:VBox&gt;
      &lt;mx:Text id="test" color="red" text="from Child:{dg.length}" /&gt;
      &lt;s:Button label="add Items" click="dg.addItem({id:'cat'})" /&gt;
  
  &lt;/mx:VBox&gt;
  
  &lt;/s:TitleWindow&gt;
  
  &lt;/s:Group&gt;
  </code></pre>
  
  <p>UPDATE: I guess my question can be more easily stated as: "is there a way to call a child's function from the parent without actually loading the child?"</p>