4 Replies Latest reply on Jul 5, 2007 6:21 AM by ion gion

    LocalConnection and BitmabData

      I have a promlem with transferring BitmapData from one swf to another by using LocalConnection:

      //1st swf
      sending_lc.send("lc_name", "functionName", 1, "2", myBitmapData);

      //2nd swf
      receiving_lc.functionName = function(a,b,c){
      trace(a);// output 1
      trace(b);// output 2
      trace(c);// output undefined <<<PROBLEM:)

      Can anybody help me, please?

      Thank you!
        • 1. Re: LocalConnection and BitmabData
          Greg Dove Level 4
          I haven't really tried anything like that... but its probably because of this:


          There is a 40 kilobyte limit to the amount of data you can pass as parameters to this command. If the command returns false but your syntax is correct, try dividing the LocalConnection.send() requests into multiple commands, each with less than 40K of data.

          • 2. Re: LocalConnection and BitmabData
            serrega Level 1
            I don't think so...
            I send small(10x10 pxs) square and it doesn't work(...
            • 3. Re: LocalConnection and BitmabData
              Greg Dove Level 4
              Yes I guess if its that small it should be OK... within the 40k limit. I'm not all that familiar with localconnection so I'll let others who know more respond.

              I just saw that 40k limit in the documentation and thought that it could be a showstopper for general use for most bitmaps (I guess you could split up the data and pass it in chunks and reassemble it, but doesn't sound like fun!). Anyhow I'm sure someone will know something about it.
              • 4. Re: LocalConnection and BitmabData
                ion gion
                No, its not about the limit, its about the complex type of the object being sent. Flash uses references for complex objects when they are passed to functions as arguments. When using LocalConnection the SWF you send the BitmapData has a different memory address space than the receiving SWF so you get an undefined.

                Try it for yourself. Use 3 tier approach of LocalConnection:

                SWF1 <-----> SWF_GATEWAY <-----> SWF2

                1) non-working scenario:

                SWF1 sends BitmapData to SWF_GATEWAY that in turns sends it to SWF2, it will not work.

                2) working scenario:

                SWF1 sends BitmapData to SWF_GATEWAY that in turns sends it back to SWF1, it will work.