| Previous | Next |
STF.readString()
Availability
| Support | PC | Mac | Package |
|---|---|---|---|
| ActionScript 3.0 |
3.9.2 |
3.9.2 |
stm.screentime.STF |
| ActionScript 2.0 |
3.0 |
3.0 |
global |
  * Add the Screentime screensaver component to your Flash FLA or Flex project before using Screentime classes.
Usage
STF.readString(fileName:String) : String
Parameters
fileName - Name of the file to read. If no path is specified, the working directory is used.
Returns
A string. This value is returned as a parameter to the registered callback. See the example below or STF.registerCallBack() for more information on callbacks and Screentime asynchronous command model.
Description
Method; Reads the contents of the specified file into a string.
ActionScript 3.0 Example:
The following example reads the contents of a file.
import stm.screentime.STF;
// define callback function
function onReadStringReturn (theString:String) :void { // define callback function function
STF.trace("The String read was -> " + theString);
}
// register callback function
STF.registerCallBack("readString", onReadStringReturn, this);
STF.writeString("File.txt", "A Test String to write"); // create the file and put a string in it
STF.readString("File.txt"); // Now read it back
ActionScript 2.0 Example:
The following example reads the contents of a file.
var content:String;
onReadStringReturn = function(returnValue:String) { // define callback
content = returnValue;
}
STF.registerCallBack("readString", onReadStringReturn, this); // register callback function
STF.readString("File.txt");
See Also
STF.writeString(), STF.appendString()
Code Examples
 
| Questions or Feedback? | Previous | Next |
