主题:  flash js通信

s22

职务:版主
等级:4
金币:10.0
发贴:1634
#12002/11/8 21:25:50
1 In the HTML page that embeds the Flash movie, add the following javascript code:

function theMovie_DoFSCommand(command, args) {
if (command == "messagebox") {
alert(args);
}
}

If you publish your movie using the Flash with FSCommand template in the HTML Publish Settings dialog box, this code is inserted automatically. The movie's NAME and ID attributes will be the file name. For example, for the file myMovie.fla, the attributes would be set to myMovie. (For more information about publishing, see Publishing.)

2 In the Flash document, add the fscommand action to a button, as shown in this example:

fscommand("messagebox", "This is a message box invoked from within Flash.")
You can also use expressions for the fscommand action and parameters, as in this example:

fscommand("messagebox", "Hello, " + name + ", welcome to our Web site!")

3 Choose File > Publish Preview > HTML to test the document.


也可以使用

getURL("javascript:functionname();");