0

Looking for a way for Javascript and Actionscript to share one copy of data in memory in a Flex Mobile app. Read on.

I'm building a Flex app where a portion of it is implemented in HTML/Javascript. In the browser, the SWF lives on the main page, and the HTML portion lives in an iframe, on that same page.

These two parts share about 1.5 MBytes of JSON data in the following way. The outermost page loads the data once, and defines a function that provides access to the loaded data. The Actionscript code uses ExternalInterface to call this function, and the HTML/Javascript code calls this function through its parent (which is the outer page). It's my assumption that both paths are accessing the same memory, and that I'm not actually marshalling data back and forth.

For the Flex Mobile version of this app, I'm using StageWebView to render the HTML part, which works well. But I don't know how I can share data between the two sides.

Please note, I've looked at StageWebViewBridge, and I'll give it another look. But at a quick glance it looks like pushing data around, not like actual memory sharing. Am I wrong?

  • If you "push data around" and that data is an object; isn't that the very definition of memory sharing? A variable that contains an object is really just a pointer to a memory space. And when you pass it; you pass the pointer; not a copy of the value stored in the memory space. [Note: Although I do not know if that is how the StageWebViewBridge actually works] – JeffryHouser Nov 11 '13 at 19:20
  • There is no such thing as "memory sharing" for scalar values in the Flash Player. All scalar data (which would include your JSON string data) is passed by value. And even if that was not the case, Flash player does not use the same memory space as your browser, so there is no way to pass by reference from one to the other. – drkstr101 Nov 13 '13 at 23:14
  • OK, Thanks drkstr1. That's what I thought. – Fred Ross-perry Nov 14 '13 at 19:21

0 Answers0