1 Reply Latest reply on Sep 14, 2007 6:42 AM by batmitra

    Communication with Files on different HTML Pages

    Ukie_239 Level 1
      I have a flex application that leads the user out of the application in a new html window. When the user leaves the application, a new flex application is embeded in the new page. Once the new page is loaded, i want to to communicate the new swf with the old swf app. When trying to communicate between the two I get:
      Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095: flash.net.LocalConnection was unable to invoke callback completeSale. error=ReferenceError: Error #1069: Property completeSale not found on flash.net.LocalConnection and there is no default value.

      For the sending swf file (the flash file), I have:
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" initialize="init()">
      <mx:Script>
      <![CDATA[
      import flash.net.LocalConnection;
      import mx.controls.Alert;

      private function init():void {
      var sending_lc:LocalConnection = new LocalConnection();
      //sending_lc.connect('myCon');
      try
      {
      sending_lc.connect('myCon');

      }
      catch (error:ArgumentError)
      {
      // server already created/connected
      trace ("ERROR SENDING")
      }

      sending_lc.send('myCon', 'completeSale');

      }
      public function completeSale():void {

      Alert.show ("SALE COMPLETE");
      }
      ]]>
      </mx:Script>
      </mx:Application>

      For the recieving swf file, I have:
      import flash.net.LocalConnection;
      public var recieve_lc:LocalConnection = new LocalConnection();

      public function init():void {
      recieve_lc.connect('myCon');
      recieve_lc.allowDomain(" http://localhost/");
      //completeSale();
      }

      public function completeSale():void {

      Alert.show ("SALE COMPLETE");
      }

      Init is called of course at the initialization of the app.

      I have no problem communucating between two swf on a single page, but can two swf on two different html pages communicate?

      Thanks