4 April 2013
Working knowledge of using a recent version of Flash Professional
All
To install Toolkit for CreateJS for Flash Professional CS6, simply open Toolkit for CreateJS.zxp with Adobe Extension Manager CS6 and restart Flash Professional.
Select Window > Toolkit for CreateJS to open the panel. You may also want to set up a keyboard shortcut for publishing to CreateJS by editing your keyboard shortcuts (Flash > Keyboard Shortcuts...) and adding a shortcut for the menu item Commands > Publish for CreateJS.
The Toolkit for CreateJS extension allows designers and animators to use Flash Professional CS6 to create assets for HTML5 projects using the CreateJS JavaScript libraries. It is not intended for building full games or experiences within Flash Pro.
It supports most of the core animation and illustration capabilities of Flash, including vectors, bitmaps, tweens, sounds, and JavaScript timeline scripting. This document contains more information on exactly what is supported.
When run on an FLA named TestFile.fla , it generates two files in the specified output directory:
This provides a quick way to preview the assets, while making it easy to link all of the assets into your own HTML files without having to edit the output.
The Toolkit also copies all necessary JavaScript libraries into the specified library directory (defaults to ./libs/ ). The Toolkit exports all images and sounds in the FLA into the appropriate directories (./images/ and ./sounds/).
If preview is checked, the panel launches the html file in the system's default browser.
Warnings are generated in the output panel for any unsupported features in your content when you publish.
CreateJS is a suite of open-source (MIT licensed) JavaScript libraries that make it easier to develop rich, interactive content for HTML5. The primary libraries that are used by the Toolkit are:
window.playSound method in the published HTML.To learn more about CreateJS, including demos and in-depth API documentation, visit the CreateJS website.
Your FLA's library is published to a JavaScript file as reusable classes within a configurable lib namespace. Toolkit supports bitmap symbols and timeline symbols. The latter are any type of symbol that has a timeline. In other words, the Toolkit attempts to publish MovieClip, Graphic, and Button symbols. Your FLA stage is also published as an instantiable class.
Similar to publishing to SWF, only symbols in use (referenced from the stage) or set to Export for ActionScript are included in the generated JavaScript library.
JavaScript class names are based on the AS3 class name set on the library item, or on the library name if a class name is not set.
Within your JavaScript, you can instantiate and work with these symbols in a manner similar to ActionScript:
var myRobot = new lib.Robot();
myRobot.leftArm.rotation = 45;
stage.addChild(myRobot);
Bitmaps and sounds are automatically copied to your output directory.
Symbols also have a nominalBounds property appended with a rectangle specifying the pixel bounds of the untransformed symbol. If you enable the multiframe bounds setting, then timeline symbols also have a frameBounds property containing an array of bounds corresponding to each frame in the timeline.
Note: Including multiframe bounds significantly increases publish time.
There are a number of restrictions to the type of timeline animations that can be published.
The extension does not currently support certain advanced features such as custom easing curves, or inverse kinematics. New (non-classic) motion tweens and shape tweens are supported, but are collapsed into frame by frame animations.
In comparison, classic tweens are maintained as runtime tweens, which makes them have a very small file size, and allows them to be manipulated through code. Note however, that any layer with a classic tween can only have a single symbol instance on it. It cannot have mixed content, and it must be an instance of the same library item for the full duration of the layer (though it can have empty frames).
Layers without classic tweens can contain any content supported by the extension (text, bitmaps, groups, vector graphics, symbols). Elements in these layers are reused between keyframes if their names match.
Toolkit supports classic tweens of most properties with simple eases (ease in/out), shape tweens (collapsed), motion tweens (collapsed), graphic instances, labels, and js scripting (see below).
It also supports mask layers with some restrictions. The mask layer cannot contain symbol instances, bitmaps or text; only vector shapes are supported. Shape tweens and keyframes are supported to allow animated masks.
Some shape-based IK animations will publish correctly, but this is an unsupported feature.
JavaScript code can be added to your timeline on a keyframe using the ActionScript panel, with the following comment format:
/* js
alert("this will run when the timeline hits this frame");
*/
Published MovieClip symbols expose methods to control the timeline, similar to ActionScript.
mc.gotoAndPlay("animateOut");
mc.gotoAndStop(10);
mc.stop();
mc.play();
JavaScript does not use this as an implicit scope like ActionScript 3, so you must specify your scope in any timeline scripts. For example:
/* js
this.onClick = function() {
this.gotoAndPlay(0);
}
*/
Note: Unlike Flash, which starts frame indexes at 1, EaselJS timelines begin at 0. This difference in indexing requires you to subtract 1 from the frame indexes displayed in Flash Professional. For example, gotoAndPlay(0) moves the playhead to the first frame of the movie clip in EaselJS, which is labeled as frame 1 in Flash Pro.
Toolkit for CreateJS supports the following instance properties for all instances:
Both Text and MovieClip instances support:
For symbol instances, the Toolkit also supports:
Note: Unlike Flash, EaselJS does not automatically update the cache on animated content. If you cache a MovieClip instance, the animation does not update properly without additional scripting.
Toolkit does not currently support color transforms, 3D transformations, or additional filters.
MovieClip, Graphic, and Button symbols with more than one frame are all published as EaselJS MovieClips with timelines. Symbols with only one frame are published as EaselJS Containers.
Buttons are published with full interactivity. Note that in some browsers content with both buttons and bitmaps may throw security errors due to restrictions in accessing local content. Test with another browser, or using a web server.
MovieClip instances behave as Graphic or Button instances based on the instance properties. There is no separate symbol types for Button or Graphic in the exported content.
For Text, the following properties are supported:
Note: multiline text may display unexpectedly. It's generally recommended to display text via HTML and CSS layered over the canvas content where possible. The DOMElement class in EaselJS can assist with this.
TLF text fields are published, but none of the advanced features of TLF are supported.
Most vector art publishes correctly. Currently, oval (non-circular) radial gradients are not supported. Likewise, bitmap (also know as pattern) fills do not support transforms on the fill. You may also see differences in stroke widths on shapes that have been scaled, or that use sub-pixel stroke sizes.
It is generally recommended that you optimize your shapes (Modify > Shape > Optimize), especially on content imported from other tools (for example, Illustrator). Optimizing significantly decreases publish time and file size.
For vector based animations, it is recommended that you tween symbols containing vector art (for example, tweening a leg symbol) rather than redrawing vectors every frame. Tweening symbols with vector art achieves smaller file sizes and faster publish times. See the sample FLA for an example of this technique.
Sounds are exported from the library, and timeline sounds are supported, including looping or repeating sounds. Sounds are exported as MP3s.
MP3 sound files are not supported in all browsers. You can manually add ogg sound files for broader support.
Sounds are limited by the restrictions on audio in the browser. See the SoundJS documentation for more details.
Toolkit makes no distinction between stream, start, and event sounds. It does not support the Stop sync action or sound effects. It does support the loop and repeat count settings.
Images are also exported from your library in either JPG or PNG32 format. Toolkit for CreateJS uses JPG unless the image has transparency, or you have set its compression type to lossless (and the original source was not a JPG). The toolkit uses the quality setting specified in the properties dialog for each image for JPGs.
This is a brief overview of each control on the Panel (top-to-bottom).
The settings dialog allows you to edit preferences for how the current FLA will be published. Here is an overview of the available settings:
frameBounds property containing an array of Rectangles corresponding to the bounds of each frame in the timeline. Note that including multiframe bounds significantly increases publish time.To get started with an example, read Getting Started with the Flash Professional Toolkit for CreateJS.
For more information and documentation on Toolkit for CreateJS, visit the Adobe Developer Connection.
For more information and documentation on the CreateJS libraries, visit the CreateJS website.