When you cast null to an object using Object(null), the result is an object.
When you cast undefined to an object using Object(undefined), the result is an object.
But saying null as Object or undefined as Object remains null.
Why is this? I can't find anything in the documentation about this.
The objects that result from these casts can have properties set on and read from them. It's as if the cast created information, or removed whatever special information the null and undefined values have. But there's no indication in the AS3 documentation that the null and undefined special types are actually objects.
There is a difference between the two casting techniques. Here is a good read on it: http://upshots.org/actionscript-3/as3-casting-objects
Basically, Object(null) actually converts null into an Object while "as" attempts to see if null can be treated as an Object, which it cannot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With