Hi,
I was trying to access swf from javascript, so this example in livedocs is what I'm trying to modify. http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html#includeExamplesSummary
However,it is not working correctly for some reason. The problem I'm encountering is that it does not work in Safari and in Firefox, it only works if I put an alert in the function before javascript pass the value to swf. (seems like it needs some time) I also tried to set a timer in as3, but timer doesn't work, only alert in js helps.
All I wanted to do is use js to tell the swf file to play ep1.swf. Here's my js code:
document.observe('dom:loaded', function() {
$('episode1').observe('click', function() {
var params = {wmode : "transparent", allowScriptAccess:"always", movie:"header"};
swfobject.embedSWF("swf/float.swf", "header", "100%", "100%", "9.0.0","expressInstall.swf", "", params, "");
sendToActionScript("ep1.swf");
});
})
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
//alert("aaa")
return document[movieName];
}
}
function sendToActionScript(value) {
thisMovie('header').sendToActionScript(value);
}
Here's my as3 code:
private function receivedFromJavaScript(value:String):void {
loader.load(new URLRequest(value));
}
I've been trying for a really long time, does anyone know how to fix this? Thanks.