JSObject-like stuff in ActionScript 3?

Posted by johncch on Stack Overflow See other posts from Stack Overflow or by johncch
Published on 2009-09-17T08:52:16Z Indexed on 2010/03/23 18:03 UTC
Read the original article Hit count: 248

Filed under:
|

I would like to ask if there is a liveconnect equivalent for ActionScript 3. I understand that there is the ExternalInterface class inside AS3 but it only supports calling a method by name. The really cool thing about Java and LiveConnect is that you can do something like

function jsFunc(name) = {
  this.name = name;
  this.talk = function(){
    alert('hello world my name is ' + this.name);
  }
}

javaapplet.function(new jsFunc("bob"));

The above approaches pseudo code since I never tested it but I've seen it in action. In AS3, while I am able to pass in an instance of JavaScript "object" into AS, it is often converted into an ActionScript Object instance which does away with all the functions as far as I'm aware.

I saw an implementation of JSInterface but I don't think it does specifically that. Is there any way to make OO like javascript work with ActionScript 3?

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about JavaScript