xJSFL is a JavaScript/JSFL framework designed to make building JSFL scripts and plugins easy.
It packages powerful core features into a structured, extensible object model, meaning more power, greater flexibility and less code for everyday JSFL development.
Never write fl.getDocumentDOM().etc().etc… again!
xJSFL has been designed from the bottom up to replace laborious syntax, and abstract repetitive tasks into elegant one-liners.
It creates a paradigm-shift from repetitive document-oriented syntax and for-loops, to object-oriented syntax and “Collection”-specific coding.
For example, to rename, randomise, and select all movieclips on the current frame, you might type:
$(':movieclip') .rename('leaf_###') .randomize ( { position:['20', '20'], width:[20, 100, 20], rotation:360, tint:{from:'green', to:'yellow', mode:'hsv'} } ) .select();
No document, timeline, layer or frame-specific code there!
Instead, notice the CSS-like selection of elements and parametrised customisation of methods.
Each Collection type (including files, documents, scenes, library items, layers, frames, keyframes, elements and shapes) comes with a slew of collection-specific methods for everyday Flash tasks.
The framework and syntax also allow you to run vanilla JSFL on elements in the collection at any time…
function reverse(element, index, timeline) { element.depth = (this.length - 1) - index; } $(':shape') .convertTo('movieclip') .each(reverse) .select();
…and you’re encouraged to package any particularly useful code into your own xJSFL extensions for further use!
Powerful development environment
I am super-excited to be developing in, and recommending the rather fantastic Komodo Edit for all xJSFL development!
Komodo Edit is a cross-platform, feature-packed and free IDE. Some of its features include a tabbed interface, industry-leading autocomplete, source code hyperlinking, a project window, snippets, templates and macros, and a full extensibility via either JavaScript or Python.
Komodo’s Code Intelligence is second to none. See below how the timeline variable in the custom callback function is automatically typed to the Timeline class, which in turn reveals currentFrame, the return value of which is automatically typed to the Frame class!

Method arguments, return types and even inline variables can be typed in this way.
xJSFL ships with a Komodo xJSFL extension, providing full auto-complete for both the JSFL language and the xJSFL framework, as well as class templates and useful development macros.
Object oriented API
As mentioned, the API has been designed around the concept of Collections, Libraries and Modules, with an elegant but powerful core which serves as the initial access point to the majority of xJSFL operations.
Everything is object-oriented, right down to the new FileSystem classes. Files and folders can now be treated as first-class, chainable objects, which can be created, written to, moved around, and opened with ease:
var file = new File('z:/test.txt', 'Some content') .copy('z:/test2.as') .append(' and some more') .open();
xJSFL even provides an optional SuperDoc class, which reorganises the 180 miscellaneous methods and properties in the Document class into something much more user-friendly. Click the diagram below to see the full extent of the reorganisation:
Transparent modularity
In order to transparently provide this kind of modular functionality, xJSFL is built around:
- reusable components such as collections, libraries, and modules
- a structured, cascading file system
- automated retrieval and loading of required files
- an anatomy for modules comprising code, ui, resources and settings
Designed for developers
xJSFL has been heavily influenced by the JavaScript jQuery and PHP Kohana frameworks, and tackles the JSFL language’s various shortcomings head on to make writing code a snap.
Features include:
- an elegant but powerful core
- a power-packed and extensible set of Collection classes and libraries
- abstraction of common workflows and functionality into simple plugin methods
- automatic retrieval and loading of resources
- related JSFL, XML and AS resources packaged as named modules
- UI templating, loading, creation and population
- automated error and user-notification management
The result is better-managed code, lightening-quick development, and an overall more enjoyable development experience. This is JSFL the way it should be!
Friendly for designers
Because of the way xJSFL restructures files into modules, these can be easily distributed to designers in easy-to-use packages.
With the Snippets module for example, you’re now free from the tyranny of the Commands menu! A hierarchical, dropdown tree of categorised snippets is always at hand to fire off code on stage selections, library items, or in fact any task of your making.

In fact, various modules will be released over the coming months to aid design-related workflows.
Download
Expected release date is October 2010, previewing at Flash on the Beach in Brighton, UK, at the end of September.
Discuss
A forum to discuss xJSFL before the release is now open at www.xjsfl.com/forum.

