Flash Media Server |
|||
| Server-Side ActionScript Language Reference > Server-Side ActionScript Language Reference > File class > File.open() | |||
Flash Media Server 2.
fileObject.open("type","mode")
type A string indicating the encoding type for the file. The following types are supported:
"text" Opens the file for text access using the default file encoding."binary" Opens the file for binary access."utf8" Opens the file for UTF-8 access.mode A string indicating the mode in which to open the file. The following modes are valid and can be combined (modes are case-sensitive and multiple modes must be separated by commas):
"read" Indicated that the file is opened for reading."write" Indicates that the file is opened for writing."readWrite" Indicates that the file is opened for both reading and writing."append" Opens file for write. Positions the file pointer at the end of the file when you attempt to write to the file."create" Creates a new file if the file is not present. If file exists, its contents are destroyed. |
NOTE |
|
If both |
A Boolean value indicating whether the file opened successfully (true) or not (false).
Method; opens a file so that you can read from it or write to it. First, you must create a file object and then call the open() method on that object. There are no default values for the type and mode parameters--values must be specified.
The following if statement lets you insert code that executes when a text file is opened in read mode:
if (myFileObject.open("text", "read") ){
// Do something here.
}