| Previous | Next |
STF.appendString()
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.appendString(fileName:String, textToAppend:String) : Boolean
Parameters
fileName - Name of the file the string should be appended to.
If a fully qualified path is not specified, the working directory is used.
textToAppend - Text string to apppend.
Returns
A boolean. This value is returned as a parameter to the registered callback. The example below demonstrates how to implement a callback to receive this return value. See STF.registerCallBack() for information on return values, callbacks, and Screentime's asynchronous command model.
Description
Method; Writes the specified text string to a file by appending it to the existing content.
If a full path is not specified, the working directory is used.
ActionScript 3.0 Example:
The following example writes the word 'hello' to a file in the application's working directory.
//--------------------------------------------------------------------------------------
// Basic Example -- the return value is not used in code executing after this command.
//--------------------------------------------------------------------------------------
import stm.screentime.STF;
// append string
STF.appendString("File.txt","hello");
//--------------------------------------------------------------------------------------
// Comprehensive Example -- the return value is used to test for success
//--------------------------------------------------------------------------------------
import stm.screentime.STF;
var success:Boolean;
// defined callback
function onAppendStringReturn (success:Boolean) :void{ // define callback function
if (success) {
STF.trace("append worked");
} else {
STF.trace("append failed");
}
}
// register callback function
STF.registerCallBack("appendString", onAppendStringReturn, this);
//append string
STF.appendString("File.txt","hello");
ActionScript 2.0 Example:
The following example writes the word 'hello' to a file in the application's working directory.
//--------------------------------------------------------------------------------------
// Basic Example -- the return value is not used in code executing after this command.
//--------------------------------------------------------------------------------------
// append string
STF.appendString("File.txt","hello");
//--------------------------------------------------------------------------------------
// Comprehensive Example -- the return value is used to test for success
//--------------------------------------------------------------------------------------
var success:Boolean;
// define callback
function onAppendStringReturn (success:Boolean): { // define callback function
if (success) {
STF.trace("append worked");
} else {
STF.trace("append failed");
}
}
// register callback function
STF.registerCallBack("appendString", onAppendStringReturn, this);
//append string
STF.appendString("File.txt","hello");
See Also
STF.writeString(), STF.readString()
Code Examples
 
| Questions or Feedback? | Previous | Next |
