You start by doing what madmatt's tutorial says and place the javascript in the head of an html file and also creating the shortcuts and vbs files and placing those in your windows directory:
Code:
<script language=JavaScript>
function exec(command) {
if (document.layers && navigator.javaEnabled()) {
window._command = command;
window.oldOnError = window.onerror;
window.onerror = function (err) {
if (err.indexOf ("User didn't grant") != -1) {
alert('command execution of ' + window._command +
' disallowed by user.');
return true;
}
else return false;
}
netscape.security.PrivilegeManager.enablePrivilege
('UniversalExecAccess');
java.lang.Runtime.getRuntime().exec(command);
window.onerror = window.oldOnError;
}
else if (document.all) {
window.oldOnError = window.onerror;
window._command = command;
window.onerror = function (err) {
if (err.indexOf('utomation') != -1) {
alert('command execution of ' + window._command +
' disallowed by user.');
return true;
}
else return false;
};
var wsh = new ActiveXObject('WScript.Shell');
if (wsh)
wsh.Run(command);
window.onerror = window.oldOnError;
}
}
</script>
Then you insert the javascript code that allows info to be taken from the Flash file (which was generated by flash when an html file is created:
Code:
<SCRIPT LANGUAGE=JavaScript>
<!--
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the the FSCommand messages in a Flash movie
function desktop_DoFSCommand(command, args) {
var desktopObj = InternetExplorer ? desktop : document.desktop;
//
// Place your code here...
//
}
// Hook for Internet Explorer
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 &&
navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
document.write('<SCRIPT LANGUAGE=VBScript\> \n');
document.write('on error resume next \n');
document.write('Sub desktop_FSCommand(ByVal command, ByVal args)\n');
document.write(' call desktop_DoFSCommand(command, args)\n');
document.write('end sub\n');
document.write('</SCRIPT\> \n');
}
//-->
</SCRIPT>
In the part that says place your code here(from above), you will need to insert :
exec(command);
Also, in the code above, the line that says:
function desktop_DoFSCommand(command, args) {
You will need to change "desktop" to the name of your flash movie(which is defined in the html where the swf file is embeded), without the extension.
Then, you will need to add the html code into the html file to call for the swf:
Code:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
width="550" height="400" ID="desktop">
<param name="movie" value="desktop.swf">
<param name="quality" value="high">
<embed src="desktop.swf" quality="high" swLiveConnect="true" NAME="desktop"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="550" height="400">
</embed></object>
You will need to change, in the object tag, the ID parameter to the name of your movie. In the next tag
<param name="movie" value="desktop.swf">
You will need to change the desktop.swf to the file of your movie.
Do that again in the embed tag for src. Then change the width and height, in the embed tag, to the width and height of your movie.
Now, everything in your html file that is needed for this to work should be done.
In flash, select the item which you want to be the shortcut (we will use a shortcut to the control panel for an example). Convert it to a button if it is not one already. Then right-click it and select action. In the window, insert the following:
Code:
on (release) {
fscommand ("control", "blank");
}
Change the text control to the name of the vbs file without the extension. That should be all, and now when you click the link in your swf(which must be opened in the html page or the link won't work) the control panel or other item will be loaded.
To see what my swf looks like, go to my post
here.
Edited to take out the smilies and to prevent a bottom horizontal scroll bar.