Saturday, March 17, 2007

Call a JavaScript function from Flash

This Flash function calls a Javascript and sends a string to be displayed in an alert window.

import flash.external.*;
btn.onPress = function() {
ExternalInterface.call("playmovie", "hi Matt");
};


Put this Javascript function in the html file
function playmovie(theMessage){   
alert(theMessage)
}

2 comments:

Unknown said...

Thanks for this very simple and well explained tutorial. It really helps me in my website.....cheers

siddhant said...

But how do I retrieve return values from the JavaScript function I just called in flash?