FS Commands
March 15, 2000
This is some tricky stuff. You can use
FS Commands to send messages to the program that "hosts" the Flash
movie (in our case it is the browser). This is very good news for
you if you are a JavaScript buff. Basically, an FS Command statement
calls the JavaScript function pengoo_in_02_DoFSCommand, (pengoo_in_02
is the name of the Flash movie). When Flash calls the function,
it feeds the Command and Arguments variables, (which you define
in the FS Command in the Flash movie), to the function.
Dude, that is like, way too many words. Let's just do it!
The first thing we need to do is write or acquire our JavaScript. I've
always been a big fan of cut and paste, so let's use this script I got
from enetserve.com.
Here is the script, as we will use it:
<SCRIPT LANGUAGE=JavaScript>
<!--
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the FSCommands
function penguin_DoFSCommand(command, args) {
// Uncomment the next line for other FS Command methods.
// var penguinObj = InternetExplorer ? penguin : document.penguin;
// In your Flash Movie use these FS Command values:
// command = openWindow
// args = http://www.yourdomain.com/
//
if(command == "openWindow") {
nwin = window.open("","NewWindow","height=300,width=300")
nwin.location=args;
}
}
// Hook for Internet Explorer
if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")
>=0 && (navigator.userAgent.indexOf("Windows 9")
>=0 || navigator.userAgent.indexOf("Windows NT")>=0)) {
document.write('<SCRIPT LANGUAGE=VBScript\> \n');
document.write('on error resume next \n');
document.write('Sub penguin_FSCommand(ByVal command, ByVal args)\n');
document.write(' call penguin_DoFSCommand(command, args)\n');
document.write('end sub\n');
document.write('</SCRIPT\> \n');
}
//-->
</SCRIPT>
|
Sorry - this particular script is for IE only. But before you roll your eyes
and mutter something you don't really mean about Flash, remember: you can
easily route each half of the online world to the page you want them to see
with a simple "browser detect"
script.
|
Notice that the function is called "penguin_DoFSCommand", and not
"pengoo-in_02_DoFSCommand". That is because the poor browser gets
discombobulated trying to figure out what the name of the function
is with all those underscores in there. So we'll stick with letters
only. (MENTAL NOTE - we will have to change the name of
"pengoo-in_02.swf" to "penguin.swf").
Once you have the script in place in pengoo-in_02.html, we are ready
to create the FS Command in Flash.
Duplicate one of your existing buttons. Name it "Bio" and change the
text on the button. Place it on the stage with your other buttons and
double click it to add an action.
In the actions tab of the instance properties dialogue, click the plus
sign to add an action. Choose FS Command.

This part is easy. For the command, type in "openWindow"; and for the
argument type in the URL of the html doc you want to open in the new
window. Hit OK and you're done.
Publishing
0 to 60 in Flash
Publishing with Different Settings - Almost
|