beautypg.com

Flfile.setattributes() – Adobe Extending Flash Professional CS5 User Manual

Page 296

background image

274

EXTENDING FLASH PROFESSIONAL

FLfile object

Last updated 5/2/2011

Usage

FLfile.remove(fileOrFolderURI)

Parameters

fileOrFolderURI

A string, expressed as a file:/// URI, specifying the file or folder you want to remove (delete).

Returns
A Boolean value of

true

if successful;

false

otherwise.

Description
Method; deletes the specified file or folder. If the folder contains files, those files will be deleted as well. Files with the
R (read-only) attribute cannot be removed.

Examples
The following example warns a user if a file exists and then deletes it if the user chooses to do so:

var fileURI = prompt ("Enter file/folder to be deleted: ", "file:///c|/temp/delete.txt");

if (FLfile.exists(fileURI)) {

var confirm = prompt("File exists. Delete it? (y/n)", "y");

if (confirm == "y" || confirm == "Y") {

if(FLfile.remove(fileURI)) {

alert(fileURI + " is deleted.");

}

else {

alert("fail to delete " + fileURI);

}

}

}

else {

alert(fileURI + " does not exist");

}

The following example deletes a configuration file created by an application:

if(FLfile.remove("file:///C|/MyApplication/config.ini")) {

alert("Configuration file deleted");

}

The following example deletes the Configuration folder and its contents:

FLfile.remove("file:///C|/MyApplication/Configuration/");

See also

FLfile.createFolder()

,

FLfile.getAttributes()

FLfile.setAttributes()

Availability
Flash MX 2004 7.2.

Usage

FLfile.setAttributes(fileURI, strAttrs)

This manual is related to the following products: