I used to work with flash all the times, in fact we used it in almost every project through college. You can do amazing things with flash very easily and honestly I love action script
![Big Smile [:D]](/emoticons/emotion-2.gif)
.
Whenever you work with flash you will find yourself need to make flash communicate with other applications.
In action script you can communicate with a host application (in my case the Browser)
through
External Interface.
To do that you to write a little JavaScript Code: First you need to get the name of the flash movie and as usual this name differs along with the browser you are using so here is a method that I found here to get you the name of the flash movie whatever the browser is:
function getFlashMovieObject(movieName) {
if (window.document[movieName]) {
return window.document[movieName];
}
if (navigator.appName.indexOf("Microsoft Internet") == -1) {
if (document.embeds && document.embeds[movieName])
return document.embeds[movieName];
}
else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
{
return document.getElementById(movieName);
}
}
// Now Call the function on your flash movie.
function SendDataToFlashMovie(data) {
var flashMovie = getFlashMovieObject("myFlashMovie");
flashMovie.JStoAS(data);}
then you have to write alittel Action Script code:
Now you have to register a callback method to respond to your method call from javascript.
import flash.external.ExternalInterface;
ExternalInterface.addCallback("JStoAS", getDataFromJavaScript);
function getDataFromJavaScript(data:String):void {
// Dod whatever you want with data here
}
and that's how it's done ![Wink [;)]](/emoticons/emotion-5.gif)
Beckham