2 Replies Latest reply on Nov 14, 2006 6:18 AM by Ukie_239

    Talking to Parent app is not possable

    Ukie_239 Level 1
      All I want to do is communicate by having my child app talk to my parent application. I cannot get this to work, and getting extremely frustrated with this. I cannot find good examples on this scenerio. Documentation does not seem to provide the details, or I just don't understand everything within the docs. I have my parent application talking to my child application, but not the other way around.

      My Main App Has
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Script >
      <![CDATA[
      import mx.managers.SystemManager;

      private var loadedSM:SystemManager;

      private function allowInteraction() : void {
      loadedSM = SystemManager(swfChild.content);
      }

      private function sendData():void {
      ChildApp(loadedSM.application).fromMain.text = toChild.text;
      }


      ]]>
      </mx:Script>
      <mx:SWFLoader id="swfChild" source="ChildApp.swf" init="allowInteraction()" y="60" width="261"/>
      <mx:Canvas width="278" height="150" id="owner">
      <mx:TextInput id="toChild" width="200" height="20"/>
      <mx:Button click="sendData();" label="Submit" y="22" />
      </mx:Canvas>
      </mx:Application>

      My Child App Has
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Script>
      <![CDATA[
      public function toParent(): void {

      //MainApp(owner).toChild.text = "123";
      parentApplication(owner).toChild.text = "123";
      //parentApplication.valueOf(toChild.text) = "123"
      //local2(owner).fromChild.text = toMain.text;

      }
      ]]>
      </mx:Script>


      <mx:Canvas width="204" height="98" x="10" y="10">
      <mx:TextArea id="fromMain" width="200" />
      <mx:TextInput id="toMain" width="200" y="32" />
      <mx:Button label="submit" x="10" y="62" click="toParent();" />

      </mx:Canvas>
      </mx:Application>


      All I want to do is have each app communicate with each other? Why is that so hard? What is it that I am missing?

      Thanks