View Full Version : javascript to flash problems
lectrospin
09-21-2009, 12:09 PM
I'm trying to call a flash function from javascript but all i get is a "flash.showAlert is not a function" javascript error.
Code is as follows:
Javascript
var flash = $('#flashcontent');
flash.showAlert();
Actionscript
protected function setup():void {
ExternalInterface.addCallback("showAlert",showAlert);
}
public function showAlert():void {
Alert.show("message recieved");
}
tadster
09-21-2009, 03:09 PM
I'm not sure how your referencing your flash object, but try :
document.getElementById('YourFlashesId').showAlert ();
if your flash object has an id, it should be reachable simply by it...
try also just using html code and no javascript to place the flash in your page, then the above code...
you can also look here: www.actiontad.com/#wrappers for an older script (none of that fancy jquery stuff, sorry ;) ) that will most of the time work to get the flash object and be able to call callbacks...
hope this helps
lectrospin
09-21-2009, 07:28 PM
the flash variable is the flash object, that's been checked and there's no problems there. Using SWFObject to launch flash shouldn't make any difference.
lectrospin
09-22-2009, 09:27 PM
the flash variable is the flash object, that's been checked and there's no problems there. Using SWFObject to launch flash shouldn't make any difference.
Actually you are correct it works with 'document.getElementById' but not using the jquery reference, strange but not unusual.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.