AS3 Error in ExternalInterface when passed null.
In AS3, calling ExternalInterface with a null value ends up tossing an error, presumeably the conversion to XML is missing a closing bracket somewhere.
TypeError: Error #1085: The element type "empty" must be terminated by the matching end-tag "".
at flash.external::ExternalInterface$/call()
What I did to workaround is create a ExternalInterfaceUtil Class that has a few static functions like:
public static function call3(param1:Object = null, param2:Object = null, param3:Object = null):Object{
if(ExternalInterface.available){
if(param1 == null || param2 == null || param3 == null){
throw Error("cannot accept null argument");
}else{
return ExternalInterface.call(param1, param2, param3);
}
}
Which is also useful to keep calls from throwing errors when run in environements that don't support ExternalInterface (like flash projectors).
