1. Create a new FLA file, and save it as myMovie.fla.
2. Drag two instances of the Button component to the Stage and give them the instance names window_btn and alert_btn, respectively, and the labels Open Window and Alert.
3. Insert a new layer on the Timeline, and rename it Actions.
4. Select Frame 1 of the Actions layer, and add the following ActionScript in the Actions panel:
5. window_btn.onRelease = function() {
6. fscommand("popup", "http://www.adobe.com/");
7. };
8. alert_btn.onRelease = function() {
9. fscommand("alert", "You clicked the button.");
10. };
11. Select File > Publish Settings, and make sure that Flash with FSCommand is selected in the Template menu on the HTML tab.
12. Select File > Publish to generate the SWF and HTML files.
13. In an HTML or text editor, open the HTML file that was generated in step 6 and examine the code. When you published your SWF file using the Flash with FSCommand template on the HTML tab of the Publish Settings dialog box, some additional code was inserted in the HTML file. The SWF file's NAME and ID attributes are the filename. For example, for the file myMovie.fla, the attributes would be set to myMovie.
14. In the HTML file, add the following JavaScript code where the document says // Place your code here.:
15. if (command == "alert") {
16. alert(args);
17. } else if (command == "popup") {
18. window.open(args, "mmwin", "width=500,height=300");
19. }