| Previous | Next |
STF.mainSWFDir
Availability
| Support | PC | Mac | Package |
|---|---|---|---|
| ActionScript 3.0 |
4.0 |
4.0 |
stm.screentime.STF stm.screentime.STFEvent |
| ActionScript 2.0 |
4.0 |
4.0 |
global |
  * Add the Screentime screensaver component to your Flash FLA or Flex project before using Screentime classes.
Usage
STF.mainSWFDir
Parameters
None.
Returns
Nothing.
Description
Event handler; The path to the folder containing the included external files and the main SWF. On the Mac this location is inside the application bundle. The values "WORKING" and "ROOTSWF" return the same path. This property contains valid information ONLY when the SWF is running as a screensaver and the ScreentimeScreensaver component has been initialized. To be notified when the STF class has been initialized, add an event listener for the STFEvent.INITIALIZATION_COMPLETE event.
The default value of this property is **workingDir**. If the SWF is running in the Flash IDE or as the installer UI (that is not running as a screensaver), this property remains at its default value.
You can change the value of this property. Replacing the default value with a hardwired path that works on your development machine can be very useful when debugging your screensaver in Flash.
ActionScript 3.0 Example:
The following example sets the active wallpaper on the computer. The variable "path" contains a fullpath to a file called image.jpg that was included as part of the screensaver installer.
import stm.screentime.STF;
import stm.screentime.STFEvent;
function onInitializationCompleteEvent(initialized:Boolean) {
var path:String;
// let's assume there is a wallpaper worthy image called image.jpg
// included in the installer in the same directory as the main screensaver swf.
// STF.pathDelimiter will be "\" on PC and "/" on Mac.
path = STF.mainSWFDir + STF.pathDelimiter + "image1.jpg";
STF.setActiveWallpaper(path);
}
STF.addEventListener(STFEvent.INITIALIZATION_COMPLETE, onInitializationCompleteEvent);
ActionScript 2.0 Example:
The following example sets the active wallpaper on the computer. The variable "path" contains a fullpath to a file called image.jpg that was included as part of the screensaver installer.
function onInitializationCompleteEvent(initialized:Boolean) {
var path:String;
// let's assume there is a wallpaper worthy image called image.jpg
// included in the installer in the same directory as the main screensaver swf.
// STF.pathDelimiter will be "\" on PC and "/" on Mac.
path = STF.mainSWFDir + STF.pathDelimiter + "image1.jpg";
STF.setActiveWallpaper(path);
}
STF.registerCallBack("onInitializationComplete", onInitializationCompleteEvent);
 
| Questions or Feedback? | Previous | Next |
