title: Unable to send variable from flash(parent) to loaded flex swf(child)?
body: <p>Hai am trying to load the variables from parent(flash) to child(flash).Its working fine,.</p>
  
  <p><strong>parent swf:</strong>(flash)</p>
  
  <pre><code>var parentMessage:String = "Hello";
  var swf:MovieClip;
  var l:Loader = new Loader();
  l.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
  l.load(new URLRequest("child.swf"));
  function swfLoaded(e:Event):void
  {
  swf = MovieClip(e.target.content);
  swf.passVariable(parentMessage);
  }
  </code></pre>
  
  <p><strong>child swf</strong>(flex)</p>
  
  <pre><code>public var childMessage:String;
  function passVariable(_msg:String):void
  {
  childMessage = _msg;
  trace("message passed from parent to child: " + childMessage);
  }
  </code></pre>
  
  <p>But while communicating with flash to flex its not loaded.</p>
  
  <p><strong>Error Message</strong></p>
  
  <blockquote>
    <p>ReferenceError: Error #1069: Property passVariable not found on
    _child_mx_managers_SystemManager and there is no default value.   at Function/()</p>
  </blockquote>
  
  <p>Kindly help me .</p>
  
  <p><strong>Update</strong></p>
  
  <p><strong>parent.swf</strong> in flash</p>
  
  <pre><code> var parentMessage:String = "Hello";
   var swf:MovieClip;
   var l:Loader = new Loader();
   l.load(new URLRequest("asd.swf"));
   swf.addEventListener("applicationComplete", swfLoaded);
   function swfLoaded(e:Event):void
   {
   var app:DisplayObject = swf.getChildAt(1);
   app["passVariable"](parentMessage);
   }
  </code></pre>
  
  <p>Child.swf in flex</p>
  
  <pre><code>&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" minWidth="955" minHeight="600"  addedToStage="application1_addedHandler(event)" &gt;
  &lt;fx:Script&gt;
      &lt;![CDATA[
          public var childMessage:String;
  
          protected function application1_addedHandler(event:Event):void
          {
  
              passVariable(childMessage);
          }
          public function passVariable(_msg:String):void
          {
  
              childMessage = _msg;
              trace("First message passed from parent to child: " + childMessage);
  }
  
      ]]&gt;
  &lt;/fx:Script&gt;
  </code></pre>
  
  <p><strong>ErrorMessage</strong></p>
  
  <pre><code>   TypeError: Error #1009: Cannot access a property or method of a null object reference.
  at Untitled_fla::MainTimeline/frame1()
     TypeError: Error #1009: Cannot access a property or method of a null object reference.
  at mx.managers::FocusManager/activate()
  at spark.components::Application/initManagers()
  at spark.components::Application/initialize()
  at asd/initialize()
  at mx.managers.systemClasses::ChildManager/childAdded()
  at mx.managers.systemClasses::ChildManager/initializeTopLevelWindow()
  at mx.managers::SystemManager/initializeTopLevelWindow()
  at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::kickOff()
  at       mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::preloader_completeHandler()
  at flash.events::EventDispatcher/dispatchEventFunction()
  at flash.events::EventDispatcher/dispatchEvent()
  at mx.preloaders::Preloader/timerHandler()
  at flash.utils::Timer/_timerDispatch()
  at flash.utils::Timer/tick()
  </code></pre>