python interoperability array help
python interoperability array help
I am trying to send an internal request from an actionscript extension to a python extension. I want to send an array to the python extension and could not find any documentation on how to do this. Any help would be much appreciated!
Exchanging language specific data structures is a little complicated, you can do it if you know the details behind the Rhino and Jython engines otherwise I would use another way.
What I would suggest is to pass native Java data structures across extensions/servlets running in different languages. Both Python and Actionscript have full access to java objects, so they provide a "common ground" for both environments.
You can use ArrayList, LinkedList for array based data, and HashMap (or ConcurrentHashMap if you need thread safety) for associative arrays/dictionaries
What I would suggest is to pass native Java data structures across extensions/servlets running in different languages. Both Python and Actionscript have full access to java objects, so they provide a "common ground" for both environments.
You can use ArrayList, LinkedList for array based data, and HashMap (or ConcurrentHashMap if you need thread safety) for associative arrays/dictionaries
supposing you're trying to send a list of strings from a Python extension to an AS extension...
on the AS side:
For all the details about collections in Java, check the J2SE javadoc --> http://java.sun.com/j2se/1.5.0/docs/api/
The package is java.util.collection
Code: Select all
from java.util import ArrayList
theList = ArrayList()
theList.add("Hello")
theList.add("World")
theASExtension.handleInternalRequest(theList)
on the AS side:
Code: Select all
function handleInternalRequest(obj)
{
trace("Array size: " + obj.size())
}
For all the details about collections in Java, check the J2SE javadoc --> http://java.sun.com/j2se/1.5.0/docs/api/
The package is java.util.collection
Return to “Server Side Extension Development”
Who is online
Users browsing this forum: No registered users and 15 guests