<script LANGUAGE="JavaScript"> -->
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="720" height="125"> <param name=quality value=high /><param name="movie" value="Menu.swf?topicname='+window.location.href+'" /><embed src="Menu.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="720" height="125"></embed> </object>');
</script>
-- there ISN'T an actionscript command that does what you want (as far as I know).
--BUT there IS a Javascript command that does it: try typing the following into your browser's URL field:
javascript:alert(window.loation.href)
You should get an popup window telling you the URL of the current page.
-- So this means that you could write a javascript function THAT LIVES ON THE WEBPAGE -- NOT IN THE SWF -- that detects the current URL.
-- there's and Actionscript command called FSCommand that can run Javascript functions on the webpage that houses the swf. So you could get the flash movie to run the Javascript function that returns the url.
-- then you've have to get this data back into the flash movie. It's possible to do that too, but I forget how. As I said, I'll work on it.
--Meanwhile, here's some info from Flash's help system about fscommand:
In the HTML page that embeds the SWF file, add the following JavaScript code:
function theMovie_DoFSCommand(command, args) {
if (command == "messagebox") {
alert(args);
}
}
If you publish your SWF file using the Flash with FSCommand template in the HTML Publish Settings dialog box, this code is inserted automatically. The SWF file's NAME and ID attributes will be the filename. For example, for the file myMovie.fla, the attributes would be set to myMovie. (For more information about publishing, see Publishing.)
Alternatively, for Microsoft Internet Explorer applications, you can attach an event handler directly in the tag, as shown in this example:
[Script Language = "JavaScript" event="FSCommand (command, args)" for= "theMovie"]
...
[/Script]
In the Flash document, add the fscommand() function to a button, as shown in this example:
on(press) {
fscommand("messagebox", "This is a message box invoked from within Flash.");
}
You can also use expressions for fscommand() and parameters, as in this example:
fscommand("messagebox", "Hello, " + name + ", welcome to our website!")
Select File \ Publish Preview \ HTML to test the document.
posted by grumblebee at 2:09 PM on June 24, 2004