7 May 2012
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 > Other Panels > 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, classic 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/ ) if they do not already exist. 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 library is published to a JavaScript file as reusable classes within a 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.
There are a number of restrictions to the type of timeline animations that can be published.
The extension does not currently support advanced features such as custom easing curves, new-style motion tweens (only classic motion tweens), inverse kinematics, masks, motion guides, or shape tweens.
Further, any layer with a 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 you can have empty frames).
Layers without 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.
The Toolkit supports classic tweens, simple easing (ease in and out), graphic instances, tweening most properties, labels, and JavaScript scripting (see below).
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, 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 without any interactivity as pure movie clips. Interactivity (for example, button states) currently must be added separately via code.
MovieClip instances behave as Graphic instances based on the instance properties (.mode, .loop, and .startPosition). There is no separate Graphic type.
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.
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.
If you do experience issues with vector output, try selecting the shape, and choosing Break Apart from the Modify menu.
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.
Note: Flash Pro has limitations on which sounds can be exported. See the "Sound Export Problems" section below for more details.
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. For example, sound on iOS is extremely limited. 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.
Flash Pro imposes some limitations on what sounds properly export from the FLA. We hope to address these limitations in a future version of Toolkit.
If you are seeing error messages when exporting sounds, try the following:
Import the new sound into your FLA and replace or delete the original sound.
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.
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.