Calling All Javascript

[ 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 ] 


Macromedia Flash MX 2004 Killer Tips
Macromedia Flash MX 2004 Killer Tips
ISBN: 0735713839
EAN: 2147483647
Year: 2003
Pages: 300
Authors: Shane Elliott

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net