class com.jgraup.system.jgFS
{
//
// PROPS
//
private static var _isFullScreen:Boolean = false;
private static var _trappedKeys:Boolean = false;
private static var _isAllowscale:Boolean = true;
//
// CONTRUCTOR
//
public function jgFS ( )
{
}
// ----------------------------
// PUBLIC FUNCTIONS
// ----------------------------
// -------------------------------------------- // SCALE
public static function get isAllowscale ( ) : Boolean
{
return _isAllowscale;
}
public static function allowScale ( isTrue:Boolean ) : Boolean
{
/*
A projector's window can always be resized by the end user.
The allowscale command determines if the animation's contents are scaled as the window is resized.
By default, this option is true. In some cases, scaling animation content is undesirable.
For example, bitmap images may become pixelated when the animation is scaled,
or frame rate may decrease as screen redraw time increases for larger screen areas.
The following script, when attached to a frame or button,
will prevent content in the Flash animation from scaling when the application window is resized:
*/
// DETERMINE IF PREFERENCE WAS PASSED
var state = ( isTrue != undefined ) ? isTrue : !isAllowscale;
// RUN SCALE MODE
fscommand ( "allowscale", state );
// SET PROPERTY
_isAllowscale = state;
// RETURN STATE
return state;
}
// -------------------------------------------- // FULLSCREEN
public static function get isFullScreen ( ) : Boolean
{
return _isFullScreen;
}
public static function toggleFullscreen ( isTrue:Boolean ) : Boolean
{
/*
* http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_14280
Determines if the the Macromedia Flash animation is displayed in a window,
or full-screen (covering the entire desktop).
The contents will also scale to fit the new window size,
provided that allowscale is set to true.
*/
// DETERMINE IF PREFERENCE WAS PASSED
var state = ( isTrue != undefined ) ? isTrue : !isFullScreen;
// RUN FULLSCREEN MODE
fscommand ( "fullscreen", state );
// SET PROPERTY
_isFullScreen = state;
// RETURN STATE
return state;
}
// -------------------------------------------- // QUIT
public static function quit ( ) : Void
{
// CLOSES THE FLASH PROJECTOR
fscommand ("quit" );
}
// -------------------------------------------- // MENU
public static function showmenu ( isTrue : Boolean ) : Void
{
/*
By default, right-clicking (on Windows) or control-clicking (on Macintosh)
within a Macromedia Flash animation displays a context menu containing
several options for changing the quality of the Macromedia Flash animation,
such as zooming in or out, printing, and others.
If you would prefer that these menu options not be available to the user,
attach the following ActionScript to the first frame of your animation:
Also hides Flash Projector menu items such as FILE, VIEW, CONTROL, HELP
Note: The 'About Macromedia Flash Player' menu option will still appear even when showmenu is set to false.
*/
fscommand( "showmenu", (isTrue != undefined) ? isTrue : false );
}
// -------------------------------------------- // TRAP ALL KEYS
public static function get trappedKeys ( ) : Boolean
{
return _trappedKeys;
}
public static function trapallkeys ( isTrue : Boolean ) : Boolean
{
/*
This allows special characters to be passed directly to the Flash animation,
instead of performing their normal functions.
For example, by invoking the trapallkeys command in a Flash animation containing a form,
you may direct the focus as you wish, rather than relying on the operating system's method of tabbing between text fields.
*/
// DETERMINE IF PREFERENCE WAS PASSED
var state = ( isTrue != undefined ) ? isTrue : !trappedKeys;
// TOGGLE TRAPPED KEY STATE
fscommand ( "trapallkeys", state );
// SET PROPERTY
_trappedKeys = state;
// RETURN STATE
return state;
}
// -------------------------------------------- // EXECUTABLES
public static function exec ( filename:String ) : Void
{
/*
-----------------------------------------------------------------------------------------------
* http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_14280
-----------------------------------------------------------------------------------------------
The exec command is used to launch an external application.
IN MACROMEDIA FLASH MX THE EXTERNAL APPLICATION MUST BE IN A SUBFOLDER NAMED 'fscommand'
THIS SUBFOLDER MUST BE IN THE SAME DIRECTORY AS THE PROJECTOR WHICH USES THE FSCOMMAND ACTIONS.
This security restriction helps prevent malicious use of the exec option.
/ flashProjector.exe
/ fscommand / filename.exe
/ fscommand / filename.bat
-----------------------------------------------------------------------------------------------
Note: exec is not capable of opening a specific file with an application, just the application itself.
One way to open files is to use exec to launch a Windows batch (BAT) file or
Macintosh AppleScript file that then opens files in the desired application.
A third-party tool that can open specific files on Windows without using batch files is available from Flashjester - http://www.flashjester.com/.
> PC VERSION
make a new file in the fscommand directory
fscommand/launcher.bat
use this one line [ DOS syntax ] to run specified file relative to BAT file
START ../files/filename.exe
-----------------------------------------------------------------------------------------------
Although it is possible to use absolute or relative paths to open applications
in folders other than the one in which the projector resides, problems have been reported
with deeply-nested directory trees or folders higher in the tree than the projector itself.
Therefore, it is preferable to keep the executables in the same folder, or a folder directly beneath it.
When specifying paths, a single dot represents the folder (equivalent to the example above ) in which the projector resides:
// points to a folder beneath the one the projector is in:
fscommand ("exec", "./foldername/someApplication.exe");
Two dots refer to the parent directory of the folder in which the projector resides:
// points to a folder in the the parent of the projector:
fscommand ("exec", "../foldername/someApplication.exe");
Preceding the path with a slash refers to the root folder of the disk the projector is on (absolute path).
// assuming the disk is D, points to D:/foldername
fscommand ("exec", "/foldername/someApplication.exe");
Use forward or backward slashes to separate folder names in Windows projectors;
use colons in Macintosh projectors. For more information see How to specify folder paths in Macintosh projectors (TechNote 15942).
*/
if ( filename != undefined ) fscommand ("exec", filename );
}
public static function execCustom ( ) : Void
{
// CREATE CUSTOM FS COMMANDS
/*
<CODE>
jgFS.execCustom ( 'myCustomCommand', prop1, prop2... );
</CODE>
*/
var type = arguments.unshift ( );
fscommand ( type, arguments );
}
}