1 Reply Latest reply on Mar 17, 2007 9:51 AM by meteoman

    Flash8 to Flex and Flex to Flash8

    meteoman

      hi everybody,


      I can't find where is the mistake....
      I have the flash 8 swf loaded in SWFloader, the flash is composed of 1 inputtext, 1 label and 1 button to send.
      In the flex, i have the same (inputtext, label and button).

      I can fill the flash's label from flex's inputtext, but it does not work from flash to flex...

      here is the code

      Flash8 :

      var receiving_lc:LocalConnection = new LocalConnection();
      receiving_lc.methodFlash = function(param1:String) {
      resultioio.text = param1.toString();
      };
      receiving_lc.connect("lc_flex2flash");

      var sending_lc:LocalConnection = new LocalConnection();
      button.onRelease = function () {
      trace(input.text);
      sending_lc.send("lc_flash2flex", "methodFlex", input.text.toString());
      }


      Flex side:
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" initialize="initApp()">
      <mx:Button x="360" y="382" label="Button" id="buton" click="envoietext()"/>
      <mx:TextInput x="179" y="382" id="inputtext"/>
      <mx:SWFLoader x="10" y="10" width="602" height="364" source="lcconnect.swf"/>
      <mx:Label x="179" y="426" text="Label" width="160" height="92" id="ioio"/>
      <mx:Script>
      <![CDATA[
      import flash.net.LocalConnection;

      private var fromFlex:LocalConnection;
      private var fromSWF:LocalConnection;
      private var unstring:String ="abc"
      private function methodFlex (param:String) : void
      {
      ioio.text = param.toString();
      }
      private function initApp() : void
      {
      fromFlex = new LocalConnection();
      fromSWF = new LocalConnection();
      fromSWF.client = this;
      fromSWF.connect("lc_flash2flex");
      }

      private function envoietext () : void
      {
      fromFlex.send("lc_flex2flash","methodFlash",inputtext.text);
      }


      ]]>
      </mx:Script>
      </mx:Application>