View Full Version : Externalinterface.addcallback error
I am trying to transfer my as2 script to as3.
This is my code which is supposed to activate the function "thefunc" and inject into it a variable called "str"
ExternalInterface.addCallback("goHome", instance, thefunc);
function thefunc(str:String):Void {gotoAndStop(str);}
i get this error .... in Firefox..."Error #1010: A term is undefined and has no properties." and it doesnt work in IE either ... any ideas ..thanks in advance
gnomeontherun
11-17-2008, 02:54 PM
More code would be helpful for us to test, but a Google search might also help find the error code details.
Apologies i was trying not to burden you with unnecessary info. here is the full code..
actionscript
import flash.external.*;
System.security.allowDomain("*");
ExternalInterface.addCallback("goHome", thefunc);
function thefunc(str:String):String {gotoAndStop(str);}
javascript
function show(frame)
{
thisMovie("topper").goHome(frame);
}
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
}
else {
return document[movieName]
}
}
The google search i did says this error is very generic..
gnomeontherun
11-17-2008, 05:10 PM
Sorry, not trying to say "google it and you'll find an answer" but I've been around this forum for long enough and know there aren't many with AS3 knowledge (I don't either).
However, with code I can at least test it and with my limited understanding give some advice.
Looking up the AS3 addCallback (http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html#addCallback())it might be something with this line
ExternalInterface.addCallback("goHome", instance, thefunc);
It says you can only have two parameters, so perhaps this helps?
nope didn't help....
never mind. I have since dropped trying to do this. But i hope that someone will be able to post a solution for anyone else in future who might want to do this..
Thanks for your help...
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.