FlashWarp: a Flash-JavaScript bridge library
FlashWarp is a library that makes JavaScript-Flash interaction easy and powerful. In addition to generic ExternalInterface features, it allows to define two-way bindings between Flash and JavaScript.
Browser Support
The library has the same requirements as the ExternalInterface
, which are either ActiveX or NPAPI support, so almost any browser with Flash should be enough. A Flash movie should be embedded with an appropriate allowScriptAccess
value for this library to work.
It can be used with any Flex or ActionScript project, including the binding support.
Binaries
Pre-built binaries are available via Bower:
bower install FlashWarp
or can be downloaded from github.
Flash Usage
Include FlashWarp.swc
to your project and define the bindings when your application starts:
1 | //Don't forget to make the binding field bindable to, |
You change a binding value mainually:
binding.value = "Hello World";
or it can be attached to a component:
<s:TextInput text="@{binding.value}" />
JavaScript Usage
Include flashwarp.min.js
and define the bindings after your SWF file is embedded into the page:
1 | //Get the Flash object by ID |
Performance and Limitations
Marshalling is built on XML, so it can be slow when you need to pass complex object or long arrays. Since all procedure calls, including the binding, are synchronous, it would hang the whole web page.
You can find the list of supported data types in Flash documentation here.