Skip to content

Nicer JavaScript objects through ExternalInterface in ActionScript 3

Notifications You must be signed in to change notification settings

begriffs/jsobject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Provides a nicer way to access JavaScript objects through ExternalInterface in ActionScript 3.

Before

ExternalInterface.call('obj.method', arg1, arg2, ...);
ExternalInterface.call('obj.method2', arg1, arg2, ...);
ExternalInterface.call('obj.method3', arg1, arg2, ...);

After

var obj = jsObject('obj');
obj.method(arg1, arg2, ...);
obj.method2(arg1, arg2, ...);
obj.method3(arg1, arg2, ...);

This library provides a global function jsObject(obj:String):Object. The argument obj names a currently instantiated JavaScript object. The function returns an ActionScript object with the same method signature as the referenced JavaScript object, but without non-method properties.

The ActionScript object stub uses ExternalInterface to pass parameters, get return values, and marshall exceptions. If the JavaScript object has no methods, or is not found, then jsObject returns null.

About

Nicer JavaScript objects through ExternalInterface in ActionScript 3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published