Firing a JavaScript Function from Flash

Probably the most valuable and simple technique that you can use with JavaScript and Flash is calling a JavaScript function using this ActionScript format:

						getURL("javascript:jsFunction()"); 

For example, in one project I wanted to call up HTML pages with lots of text. While text is relatively “light” in HTML, it can really bog down a Flash movie. I created three buttons in Flash, and each one contained this script, with a variation on the function swissy1()–swissy2() and swissy3().

						on (release) {
       getURL ("javascript:swissy1()"); 
} 

Figure 18.1 shows the script in the Object Actions window being developed in Flash.

Figure 18.1. Linking JavaScript functions to a Flash movie is simple.

After the HTML ...

Get JavaScript Design now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.