
64
SERVER-SIDE ACTIONSCRIPT LANGUAGE REFERENCE FOR ADOBE MEDIA SERVER 5.0.1
Server-Side ActionScript Language Reference
Last updated 7/2/2013
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—for example, "read,write"; there is no
default value):
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.
Value Description
"text" Opens the file for text access by using the default file encoding.
"binary" Opens the file for binary access.
"utf8" Opens the file for UTF-8 access.
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.
Comentarios a estos manuales