javascript - Get the domain where flash swf file is being played -
so want domain flash swf being played , not location of file. if externalinterface
return value so:
var domain:string = externalinterface.call("document.domain");
but above produces null
.... banner ad can't pass flashvars
or call custom js
functions
it returns null
because you're not calling nothing:
document.domain
name of variable, not method call.
try return document.domain
instead.
edit:
the correct syntax create anonymous function returns document's domain:
import flash.external.externalinterface; var domain:string = ""; if (externalinterface.available == true) { try { domain = externalinterface.call("function() { return document.domain; }"); } catch (err:error) { domain = "error: " + err.message; } if (domain == null) domain = "no domain" }
Comments
Post a Comment