Export a composition as an XFL file to Flash Professional



You can export a composition from After Effects to the XFL format for further modification and use in Flash Professional CS4. For example, you can use ActionScript in Flash Professional to add interactive animation to each of the layers from an After Effects composition.

When you export a composition as an XFL file, After Effects attempts to export individual layers and keyframes, preserving as much information for direct use in Flash Professional as it can. If After Effects can’t export an element of a composition as unrendered data in an XFL file, the element is either ignored or rendered into a PNG or FLV item, depending on whether you choose to ignore unsupported features.

For a video tutorial on exporting to XFL format, go to the Adobe website at www.adobe.com/go/lrvid4098_xp.

About XFL files

XFL files are essentially the XML equivalent of FLA files. An XFL file is a compressed archive folder that contains a Library folder and an XML document (DOMDocument.xml) that describes the FLA file. The Library folder contains the assets referred to by the XML file. When you open an XFL file in Flash Professional, it extracts these items from the XFL file and uses them to build a FLA document. You save the document from Flash Professional as a new FLA file; you do not change the XFL file with Flash Professional.

If you want to examine or manually edit the contents of an XFL file, you can open the compressed archive file in the same manner as any other .zip file. Changing the filename extension to .zip is not necessary, but it may make extracting the files for this manual examination more convenient.

Exporting a composition to XFL format

  1. To export the selected composition as an XFL file, choose File > Export > Adobe Flash Professional (XFL).

  2. In the Adobe Flash Professional (XFL) Settings dialog box, choose what After Effects will do with layers with unsupported features:

    Ignore
    Layers with unsupported features are not included in the XFL output.

    Rasterize To
    Layers with unsupported features are rasterized. This means that the layers are rendered to a bitmap format (an FLV file or a sequence of PNG images). Vectors are not preserved. This preserves the appearance of the layer when the XFL file is used in Flash Professional. When rasterizing to a PNG sequence, identical adjacent frames are rasterized only once, to a single PNG file that is referenced multiple times.

  3. (Optional) Click the Format Options button and modify the settings used for creating PNG sequences or FLV files.

    If you click Format Options when FLV is chosen in the Format menu, the FLV|F4V (H.264) export settings dialog box opens. Though you can modify such items as the bit rate, in general you won’t need to change many settings in this dialog box. Changes that you make in this dialog box persist and are used for subsequent export operations, so be careful about what you change.
    Note: The video format used for XFL export is FLV, not F4V, so the video codecs available in this dialog box are On2 VP6 and Sorenson Spark.

    If you make a change to the format options that you would like to undo, click the Reset To Defaults button in the Adobe Flash Professional (XFL) Settings dialog box.

  4. In the Export As Adobe Flash Professional (XFL) dialog box, choose a location for the output files.

As the composition is being processed, a dialog box shows the progress of the export operation.

When After Effects creates an XFL file, it also saves a report ([XFLfile_name] report.html) to the same folder as the XFL file. The report indicates the following:

  • whether layers with unsupported features were rasterized or ignored

  • whether each source item was rasterized (“rendered”) or passed through (“linked”)

  • whether each layer was rasterized (“rendered”) or converted to a native Flash object

Working in Flash Professional with a FLA document created from an XFL file

The Library panel in Flash Professional is similar to the Project panel in After Effects. When Flash Professional creates a FLA document from an XFL file, it creates symbols, folders, and video clips and organizes them in the Library panel. Each item in the Library panel has a unique name—even if they are based on items with identical names in After Effects—so that these items can be manipulated using ActionScript. This requirement for unique naming causes After Effects to append underscore characters and numerals to many names when creating the XFL file.

When Flash Professional builds a FLA document from an XFL file that includes FLV files, the FLV files are embedded in the timeline in Flash. Often, a more efficient way to construct a FLA document is to move the video files to an external location referenced by the SWF file to stream the video. You can unembed FLV files as appropriate within Flash Professional, by deleting the video and importing it again using the FLVPlayback component.

Note: In After Effects, the composition’s timeline begins at frame 0. In Flash Professional, the timeline begins at frame 1. This difference causes the After Effects composition timeline and the corresponding Flash timeline to appear to be offset from one another by one frame.

In After Effects, a composition can have pixel aspect ratios other than 1.0 (square pixels). Flash Professional only supports a pixel aspect ratio of 1.0. When a composition is exported to XFL format, the FLA document is a square-pixel document with a different number of pixels so that the appearance of the document in Flash Professional matches the appearance of the composition in After Effects. Scale values in the XFL file preserve the appearance of the layers.

How features and data are preserved when exporting a composition to XFL format

When a composition is exported as an XFL file, After Effects goes through multiple stages, attempting at each stage to export the maximum amount of information from layers and their source files.

If the composition uses PNG, JPEG, and FLV files as the sources for its layers, these source files are included in the XFL output (passed through) unless the layers use features that force After Effects to transcode the source files or rasterize the layers for export to XFL.
Note: Transcoding is the conversion of a source file from one format to another format, such as from GIF to PNG. Rasterizing is the conversion of a layer to a bitmap image, incorporating all of the model information—such as vectors and keyframes—into a flattened, pixel-based image for each frame.

Stage 1: Source files are passed through unchanged, if possible.

For a layer’s source file to be passed through to the XFL file, the layer must meet these requirements:

  • The layer has a source footage item, and that footage item uses a PNG or JPEG sequence or FLV file as its source. (The layer is not a text layer, camera layer, light layer, or shape layer.)

  • The source footage item’s frame rate matches the composition’s frame rate.

  • The layer’s source is not trimmed.

  • The layer does not extend before the first frame or after the last frame of the composition work area.

  • The layer has no properties other than Position, Anchor Point, Opacity, Scale, and Rotation. Because effects add properties to layers, this requirement also means that the layer has no effects applied.

  • The layer does not have motion blur, frame blending, or time-remapping applied.

  • The layer does not have a track matte.

  • There is no adjustment layer above the layer.

  • Layers above do not use blending modes other than Normal.

  • The layer does not have the Preserve Transparency option set, nor does any layer above it.

  • The layer is not a 3D layer.

Stage 2: Remaining source files are converted to PNG sequences or FLV files, if possible.

If the only reason that a layer’s source file can’t be passed through to the XFL file is that it doesn’t use a PNG sequence, JPEG sequence, or FLV file as its source, then the layer’s source is transcoded or rasterized to a PNG sequence or FLV file, which is included in the XFL file. In this case, the layer’s Position, Opacity, Scale, and Rotation keyframes are preserved and converted to keyframes in the XFL output. If multiple layers use the same source in After Effects and meet all of the other pass-through requirements listed above, they will also share a common source in the document created in Flash Professional. Precompositions can be rasterized as source items.

The XFL file created from a composition preserves the animation information for the layers in the composition. Keyframes for the Position, Opacity, Scale, and Rotation properties are converted to keyframes in Flash Professional, with one keyframe per frame for each animated property. Only 2D Position (x and y) keyframes and 2D (z) Rotation keyframes are converted.

In After Effects, the Anchor Point property can be animated, but the transformation point in Flash Professional can’t be animated. In Flash Professional, the transformation point is located at the top-left corner of the symbol. Keyframe animations of transform properties (including Anchor Point) in After Effects are converted to animations based around the transformation center in the exported XFL file.

Stage 3: Remaining layers are rasterized as individual layers, if possible.

If a layer doesn’t meet the requirements for its source file to be passed through, transcoded, or rasterized as a source item, then the layer itself must be rasterized as a layer. Rasterizing a layer means that all of its keyframe information is lost—all of the information is contained in the rasterized image frames themselves.

To be rasterized as an individual layer, a layer must meet these requirements:

  • The layer is either based on a video footage item (including a solid) or is a shape layer or text layer. (The layer is not a camera layer, light layer, or audio-only layer.)

  • There is no adjustment layer above the layer.

  • Layers above do not use blending modes other than Normal.

  • The layer does not have a track matte.

  • The layer does not have the Preserve Transparency option set, nor does any layer above it.

  • The layer is not a 3D layer.

Stage 4: Remaining layers are rendered and rasterized together in bins.

If a layer doesn’t meet the requirements for rasterization to an individual layer, then it is rendered and rasterized together with other layers in a group (bin). Bins of layers that are rasterized together are generally 3D layers, layers that are composited together with blending modes, track mattes, and layers affected by an adjustment layer.

Limitations of exporting a composition to XFL format

When Flash Professional opens an XFL file, it must load all of the assets into memory. After Effects warns you when you export a composition for which the assets will consume more than 580 MB. Similarly, After Effects warns you if the amount of time that an XFL file will take to open in Flash Professional is very large because the number of frames in a PNG sequence is greater than 1,050. You can still export a composition to XFL format if it exceeds these limits, but you may not be able to open the XFL file with Flash Professional.

To prevent the long load times related to sequences with a large number of PNG files, consider pre-rendering layers based on PNG sequences to FLV format.

After Effects relies on the embedded version of the Adobe Media Encoder to create FLV files. The Adobe Media Encoder can’t create FLV files with pixel dimensions greater than 1920x1080.

When you export a composition to the XFL format from a 32-bpc project, the rendering of colors with values under 0 and over 1 does not produce results that preserve the appearance of the composition in After Effects. You should only work in an 8-bpc or 16-bpc project when creating a composition that you intend to export to Flash Professional in XFL format.

Audio is not exported to the XFL file.