Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/begriffs/jsobject

Nicer JavaScript objects through ExternalInterface in ActionScript 3
https://github.com/begriffs/jsobject

Last synced: 3 months ago
JSON representation

Nicer JavaScript objects through ExternalInterface in ActionScript 3

Awesome Lists containing this project

README

        

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.