Getting ActionScript UserVariables with Java
Posted: 02 Jul 2007, 11:27
Hi!
In my current project I'm using a mix of ActionScript and Java (like 6.6 in the Docs). Basically I use embedded Java classes for areas that need optimal performance.
I'm in the process of converting one of my Actionscript functions to a Java method, but I'm running into a snag. In Actionscript I've stored a numerical list into a user variable, like this:
Now in my Java method I'm trying to retrieve the value of the user variable. However, it only returns a string type:
I looked at the UserVariable.setType() method, but I don't think that will convert the value string to an integer list. Can you only use strings for user variables in Java?
Please note, I'm a Java beginner.
So I very well could be missing something very obvious.
Thanks for any help.
In my current project I'm using a mix of ActionScript and Java (like 6.6 in the Docs). Basically I use embedded Java classes for areas that need optimal performance.
I'm in the process of converting one of my Actionscript functions to a Java method, but I'm running into a snag. In Actionscript I've stored a numerical list into a user variable, like this:
Code: Select all
var mylist = [1,2,3,4,5]
user.properties.put("MyList", mylist)
Code: Select all
UserVariable mylist_uvar = myUser.getVariable("MyList");
String mylist_nums = mylist_uvar.getValue();
/**
* Obviously this next step won't work because it's the wrong type
* But I need to somehow to get it so I can read the integers
* from the list.
*/
int num1 =mylist_nums[0];
int num2 = mylist_nums[1];
int num3 = mylist_nums[2];
Please note, I'm a Java beginner.
Thanks for any help.