beautypg.com

Flfile.getsize(), Flfile.listfolder() – Adobe Extending Flash Professional CS5 User Manual

Page 293

background image

271

EXTENDING FLASH PROFESSIONAL

FLfile object

Last updated 5/2/2011

FLfile.getSize()

Availability
Flash MX 2004 7.2.

Usage

FLfile.getSize(fileURI)

Parameters

fileURI

A string, expressed as a file:/// URI, specifying the file whose size you want to retrieve.

Returns
An integer that represents the size of the specified file, in bytes, or 0 if the file doesn’t exist.

Description
Method; returns an integer that represents the size of the specified file, in bytes, or 0 if the file doesn’t exist. If the return
value is 0, you can use

FLfile.exists()

to determine whether the file is a zero-byte file or the file doesn’t exist.

This method returns correct file size values only for files that are less than or equal to 2GB in size.

Example
The following example stores the size of the mydata.txt file in the

fileSize

variable:

var URL = "file:///c|/temp/mydata.txt";

var fileSize = FLfile.getSize(URL);

FLfile.listFolder()

Availability
Flash MX 2004 7.2.

Usage

FLfile.listFolder(folderURI [, filesOrDirectories])

Parameters

folderURI

A string, expressed as a file:/// URI, specifying the folder whose contents you want to retrieve. You can

include a wildcard mask as part of folderURI. Valid wildcards are * (matches one or more characters) and ? (matches
a single character).

filesOrDirectories

An optional string that specifies whether to return only filenames or only folder (directory)

names. If omitted, both filenames and folder names are returned. Acceptable values are

"files"

and

"directories"

.

Returns
An array of strings representing the contents of the folder. If the folder doesn’t exist or if no files or folders match the
specified criteria, returns an empty array.

This manual is related to the following products: