3 Replies Latest reply on Mar 27, 2011 9:29 PM by kglad

    LocalConnection troubles


      I've got two files A and B. A generates a random number in a dynamic text box and loads an image as the background:


      function(){return A.apply(null,[this].concat($A(arguments)))}

      display.text = String(Math.floor(Math.random()*9999));
      loadMovie("background.jpg", empty);


      var desktop:Object = new Object ();
      desktop.onLoad = function ():Void {
            var sending_lc:LocalConnection = new LocalConnection();
            var textToSend = display.text;
            sending_lc.send("randomnumber", "recievenumber", textToSend);




      so that the number can be sent to B:


      function(){return A.apply(null,[this].concat($A(arguments)))}

      feedback.text = "";
      var answer = feedback.text;
      var receiving_lc:LocalConnection = new LocalConnection();
      receiving_lc.recievenumber = function(textRecieved:String) {
           feedback.text += textRecieved+"\n";


      I'm trying to avoid useing a button to send the number from A to B, and instead am trying to use an event listener that sends the number when A loads background.jpg; but the number never gets sent (I start with B open already, and then open A). I've gotten this to work with an onRelease event for a button , so i know the LocalConnection coding works, but as I said I want to avoid using a button to send the number.


      I'm sure it's right in front of me but i've got no clue why it isn't working, so I defer to wiser minds. Thanks in advance.