I want to do something like this in Actionscript 3:
if(variable is Object) ...;
else ...;
Where variable could be a String(), Number(), Array(), Object()…
Currently the above check returns true for all of these types, which makes sense. I only want it to return true for objects made with new Object(), however.
Any help would be much appreciated!
You should try to use this functions –
getQualifiedClassNameandtypeof. Here’s a code showing how they behave for different data types you’ve listed, see the difference for the Array and Numbers especially:Code:
Result:
I assume getQualifiedClassName would be what you’re looking for, which is in the flash utils package: