SharpFlash
: Extending Flash on the
Desktop
Last updated : Oct 4, 2003
[ about ]
[ change log ]
[ download ]
[ actionscript api
] [ credits/help ]
About
SharpFlash is a third-party tool (released under the GNU
General Public License) allowing Flash applications to have more power on
operating systems supporting the .NET Framework. It exposes (read: in the
future, it will expose) an ActionScript API allowing a Flash application to
have as much control over the environment as a native desktop application
has. This includes things like allowing
file access (both read/write), registry access, internet access, etc. The API
is still under heavy development, but the code has stabilized to a pre-alpha
state. Written in C#, SharpFlash takes
advantage of a Flash User Interface.
Additionally, SharpFlash was built with SharpFlash, demonstrating the
power of the program.
Change Log
- Oct 4, 2003
- Added:
- sfFile.deleteFile(path, callback, scope)
- sfFile.exists(path, callback, scope)
- Changed:
- sfSystem.MessageBox.messageBox callback now only accepts 1 parameter
- the string name of the button that was selected. The "success"
parameter has been removed.
- Aug 30, 2003
Download
To download SharpFlash, visit the project page on SourceForge (http://sourceforge.net/projects/sharpflash/) .
There is a README.txt file included in the binary/source
archive. Please read the README.txt
completely before attempting to use the program.
ActionScript API
These are the functions currently implemented. Many more are on their way and will be added
as time allows. I’ll be adding better
documentation at some point as well.
- sfWindow
- sfWindow.getWindowTitle(callback, scope);
- @param
callback : Function, required; - The function
to execute when the getWindowTitle is finished
processing.
- @param scope : Object, optional; The object that will be
“this” in the callback function.
- The
callback function receives 1 param: title.
- Example:
function title_Callback(title) {
a_txt.text = “The text in the window titlebar
is: “ + title;
}
sfWindow.getWindowTitle(title_Callback);
- sfWindow.setWindowTitle(title);
- @param
title : String, required;
- Sets
the text in the titlebar of the window to be
what is contained in the title param.
- sfWindow.moveTo(x, y);
- @param x : Int, required; The x location to move the window to.
- @param y : Int, required; The y location to move the window to.
- sfWindow.hide();
- sfWindow.show();
- sfWindow.toggleVisibility();
- Toggles
the window visibility (if hidden then shows, if visible then hides)
- sfApplication
- sfFile
- sfFile.deleteFile(path, callback, scope);
- Deletes the file in the specified path
- @param path : string, required
- @param callback : function optional
- @param scope :object optional
- The callback function takes in 2 params, success and message. If
success is false, the message will contain the error the occurred.
- Example:
function delete_callback(success, message) {
if (success) {
// file deleted successfully
} else {
_root.error_txt.text = "error deleting file -
" + message;
}
}
sfFile.deleteFile("C:\\example.txt", delete_callback);
- sfFile.exists(path, callback, scope);
- Determines if the file specified by the path exists
- @param path : string, required
- @param callback : function optional
- @param scope :object optional
- The callback function takes in 1 param - exists. Exists is a boolean
value indicating if the file exists or not.
- Example:
function exists_callback(exists) {
if (exists) {
// file exists!
} else {
// file does not exists
}
}
sfFile.exists("C:\\example.txt", exists_callback);
- sfSystem
- sfSystem.Dialogs
- sfSystem.Dialogs.BrowseForFile_Open(fileName, typeFilter, intialPath, caption, callback, scope);
- //
documentation not written yet
- Example
fileBrowse_Callback
= function(success, fileName)
{
if (success) {
_root.window_mc.swf_txt.text = fileName;
}
}
sfSystem.Dialogs.BrowseForFile_Open( "",
["SWF (*.swf)", "*.swf"],
"", "Browsing for .swf file . . .",
fileBrowse_Callback);
- sfSystem.MessageBox
- sfSystem.MessageBox.messageBox(text, caption,
buttons, icon, defaultButton, options,
callback, scope);
- @param text : String, required; The text in the message box.
- @param
caption : String, required; The text in the
title bar of the message box.
- @param buttons : ID, required; The button set to display. buttons needs to be one of the
following IDs:
- MBB_AbortRetryIgnore
- MBB_OK
- MBB_OKCancel
- MBB_RetryCancel
- MBB_YesNo
- MBB_YesNoCancel
- @param
icon : ID, required; The icon to display. Icon needs to be one of the following
IDs:
- MBI_Asterisk
- MBI_Error
- MBI_Exclamation
- MBI_Hand
- MBI_Information
- MBI_None
- MBI_Question
- MBI_Stop
- MBI_Warning
- @param
defaultButton : ID, required; The button that is selected by
default. defaulyButton
needs to be one of the following IDs:
- MBD_Button1
- MBD_Button2
- MBD_Button3
- @param
options : ID, required; not implemented yet, just pass “null”
(minus the quotes).
- @param
callback : Function, required; - The function
to execute when the messageBox is finished
processing.
- @param scope : Object, optional; The object that will be
“this” in the callback function.
- Example:
function
mb_callback(whichButton)
{
switch (whichButton) {
case “OK”:
//
ok button pressed
break;
case “Cancel”:
//
cancel button pressed
break;
}
}
sfSystem.MessageBox.messageBox(“Message
Box Text”, “Message Box Title”, MBB_OKCancel, MBI_Information, MBD_Button2, null, mb_callback);
- sfPrivate
- sfPrivate.build(options);
- Internal
– used to build an executable file.
- More
to come . . .
Credits/Help
SharpFlash is written and maintained
by Darron Schall (www.darronschall.com). If you would like to help, please let me
know.