beautypg.com

Chapter 6: flash integration, The flash objects api, Swffile.createfile() – Adobe Dreamweaver API Reference CS5 User Manual

Page 44

background image

39

Last updated 8/27/2013

Chapter 6: Flash integration

Adobe® Dreamweaver® provides support for the Flash Object API, which leverages the Flash Generator Template file
to create new Flash objects. The Flash Objects API topic provides details for the creation of Flash objects (SWF files)
from Flash Generator templates (SWT files).

For information about adding Flash content to Dreamweaver objects or commands, see Extending Dreamweaver.

The Flash Objects API

The Flash Objects API lets extension developers build objects that create simple SWF files through Flash Generator.
This API provides a way to set parameters in a Flash Generator template and output as a SWF file, or image file. The
API lets you create new Flash objects as well as read and manipulate existing Flash objects.

The SWT file is a Flash Generator Template file, which contains all the information necessary for you to construct a
Flash Object file. These API functions let you create a SWF file (or image file) from an SWT file. The SWF file is created
by replacing the parameters of the SWT file with real values. For more information on Flash, see the Flash
documentation. The following functions are methods of the

SWFFile

object.

SWFFile.createFile()

Description
This function generates a new Flash Object file with the specified template and array of parameters. It also creates a
GIF, PNG, JPEG, and MOV versions of the title if filenames for those formats are specified.

If you want to specify an optional parameter that follows optional parameters that you do not want to include, you
need to specify empty strings for the unused parameters. For example, if you want to specify a PNG file, but not a GIF
file, you need to specify an empty string before specifying the PNG filename.

Arguments
templateFile, templateParams, swfFileName, {gifFileName}, {pngFileName}, {jpgFileName}, {movFileName},
{generatorParams}

The templateFile argument is a path to a template file, which is expressed as a file:// URL. This file can be a SWT file.

The templateParams argument is an array of name/value pairs where the names are the parameters in the SWT file,
and the values are what you want to specify for those parameters. For Dreamweaver to recognize a SWF file as a
Flash object, the first parameter must be

"dwType"

. Its value should be a string that represents the name of the

object type, such as

"Flash Text"

.

The swfFileName argument, which is expressed as a file:// URL, is the output filename of an SWF file or an empty
string to ignore.

The gifFileName argument, which is expressed as a file:// URL, is the output filename of a GIF file. This argument
is optional.

The pngFileName argument, which is expressed as a file:// URL, is the output filename of a PNG file. This argument
is optional.