Testing for undefined and null child objects in ActionsScript/Flex

Posted by dbasch on Stack Overflow See other posts from Stack Overflow or by dbasch
Published on 2010-05-20T00:57:45Z Indexed on 2010/05/20 1:00 UTC
Read the original article Hit count: 434

Hi Everyone,

I use this pattern to test for undefined and null values in ActionScript/Flex :

if(obj) {
    execute()
}

Unfortunately, a ReferenceError is always thrown when I use the pattern to test for child objects :

if(obj.child) {
    execute()
}

ReferenceError: Error #1069: Property child not found on obj and there is no default value.

Why does testing for child objects with if statements throw a ReferenceError?

Thanks!

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about flex