Macromedia Flash MX 2004 Killer Tips

[ LiB ] 

Calling All Javascript!

At first, you may think that calling a JavaScript function from Flash is difficult, but it's really not. Knowing JavaScript itself is going to be the hardest part about this tip. If you have a JavaScript function defined on the same HTML page where your Flash movie is embedded, then all you have to do is put the following code in your document.

On a button or movie clip instance:

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

On a keyframe (frame action):

getURL("javascript:myFunction();");

It's actually the same concept as targeting an HTML page, except you put "javascript:" followed by the function you're calling where the URL would be.

[ LiB ] 

Категории