I am very new to both JavaScript and ActionScript. I am trying to get javascript to call a function in ActionScript and store the returned array. I have looked everywhere for help and i cant seem to get this to work. My actionscript is below:
import flash.display.Sprite;
import flash.text.Font;
import flash.text.FontType;
import flash.text.FontStyle;
import flash.external.*;
public class FontList extends Sprite
{
public function FontList()
{
ExternalInterface.call('populateFontsList', getDeviceFonts());
ExternalInterface.addCallback('getFonts', getDeviceFonts);
}
There is a getDeviceFonts() method that works, and the .call function works too, calling the function within the javascript. However, when i try and call the getFonts method in javascript it dosent work. Relavent Javascript is as below:
function getFlashMovie(movieName) {
var isIE = navigator.appName.indexOf("Microsoft") != -1;
return (isIE) ? window[movieName] : document[movieName];
}
var fontArray = getFlashMovie("FontList.swf").getFonts();
Am i missing something here?