Hi,
I am having a weird casting problem: I am receiving this error
TypeError: Error #1034: Type Coercion failed: cannot convert shared.plugins.toolbar2.toolbar::Globalization@18f84d9 to shared.plugins.toolbar2.toolbar.Globalization.
The getter function is this one
private function get localeFormatter(): Globalization {
trace("commons.getItem(\"localeFormatterTB\") = " + commons.getItem("localeFormatterTB"));
trace("commons.getItem(\"localeFormatterTB\") is Globalization -> " + (commons.getItem("localeFormatterTB") is Globalization));
trace(flash.utils.getQualifiedClassName(commons.getItem("localeFormatterTB")));
trace(flash.utils.getQualifiedClassName(Globalization));
return commons.getItem("localeFormatterTB");
}
Trace returns the following lines
commons.getItem("localeFormatterTB") = [object Globalization]
commons.getItem("localeFormatterTB") is Globalization -> false
shared.plugins.toolbar2.toolbar::Globalization
shared.plugins.toolbar2.toolbar::Globalization
TypeError: Error #1034: ...
The error is triggered when trying to return the value, that should be cast to Globalization, but it looks like it already is of type Globalization, so why there should be a casting problem? It is really weird to see that “is Globalization” returns false, even if it is evident by the following trace that it IS.
I don’t think it is in some way related to application domain or similar, because Globalization class is always the same through all swfs using it (just another one).
Another weird detail is that this function works correctly for the same game if put in a different folder (domain).
Any idea?