MACROMEDIA FLASH MEDIA SERVER 2-SERVER MANAGEMENT ACTIONSCRIPT LANGUAGE Manuale Utente Pagina 56

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 155
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 55
ADOBE FLASH MEDIA INTERACTIVE SERVER
Server-Side ActionScript Language Reference
53
Note: If both "read" and "write" are set, "readWrite" is automatically set. The user or process owner that the server
runs under in the operating system must have write permissions to use “create”, “append”, “readWrite”, and “write
modes.
Returns
A boolean value indicating whether the file opened successfully (
true) or not (false).
Example
The following client-side script creates a connection to an application called file:
var nc:NetConnection = new NetConnection();
function traceStatus(info) {
trace("Level: " + info.level + " Code: " + info.code);
}
nc.onStatus = traceStatus;
nc.connect("rtmp:/file");
The following server-side script creates a text file called log.txt and writes text to the file:
application.onConnect = function(client){
this.acceptConnection(client);
var logFile = new File("log.txt");
if(!logFile.exists){
logFile.open("text", "append");
logFile.write("something", "somethingElse")
}
};
File.position
fileObject.position
The current offset in the file. This is the only property of the File class that can be set. Setting this property performs
a seek operation on the file. The property is undefined for closed files.
Availability
Flash Media Server 2
File.read()
fileObject.read(numChars)
Reads the specified number of characters from a file and returns a string. If the file is opened in binary mode, the
operation fails. When this method fails, it invokes the
application.onStatus() event handler to report errors.
Value Description
"read" Opens a file for reading.
"write" Opens a file for writing.
"readWrite" Opens a file for both reading and writing.
"append" Opens a file for writing and 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 a file exists, its contents are destroyed and a new file is
created.
Vedere la pagina 55
1 2 ... 51 52 53 54 55 56 57 58 59 60 61 ... 154 155

Commenti su questo manuale

Nessun commento