Reputation: 465
I need to import from inside flash an Array from a JS function, and display it in Dynamic Text in Flash, my code is :
AS2:
import flash.external.ExternalInterface;
js_btn.onRelease = function() {
_root.infoBox.text = ExternalInterface.call("getUserInfo()");
}
JS:
function getUserInfo() {
var userinfo = {fullname: 'George One', username: 'goergeo', picturelink: 'http://link.com'};
return userinfo;
}
Once I press the button, I get "undefined" in the text box! Any help is really appreciated.
Upvotes: 0
Views: 273
Reputation: 465
The correct AS2 code is as below:
import flash.external.*;
js_btn.onPress = function() {
allUserInfo = Object(ExternalInterface.call("getUserInfo"));
_root.infoBox.text = allUserInfo["fullname"];
}
Upvotes: 1