beautypg.com

Swffile.getobjecttype(), Swffile.readfile() – Adobe Dreamweaver API Reference CS5 User Manual

Page 46

background image

41

DREAMWEAVER API REFERENCE

Flash integration

Last updated 8/27/2013

Returns
An array that contains two elements that represent the width and the height of an uncompressed SWF file or a

null

value if the file is not an uncompressed SWF file.

SWFFile.getObjectType()

Description
This function returns the Flash object type; the value that passed in the

dwType

parameter when the

SWFFile.createFile()

function created the file.

Arguments
fileName

The fileName argument, which is expressed as a file:// URL, is a path to a Flash Object file. This file is usually a SWF file.

Returns
A string that represents the object type, or

null

if the file is not a Flash Object file or if the file cannot be found.

Example
The following code checks to see if the test.swf file is a Flash object of type

myType

:

if ( SWFFile.getObjectType("file:///MyMac/test.swf") == "myType" ){

alert ("This is a myType object.");

}else{

alert ("This is not a myType object.");

}

SWFFile.readFile()

Description
This function reads a Flash Object file.

Arguments
fileName

The fileName argument, which is expressed as a file:// URL, is a path to a Flash Object file.

Returns
An array of strings where the first array element is the full path to the template SWT file. The following strings
represent the parameters (name/value pairs) for the object. Each name is followed in the array by its value. The first
name/value pair is

"dwType"

, followed by its value. The function returns a

null

value if the file cannot be found or if

it is not a Flash Object file.

Example
Calling

var params = SWFFile.readFile("file:///MyMac/test.swf")

returns the following values in the

parameters array: