Search This Blog

Wednesday, May 19, 2010

Testing for undefined and null child objects in ActionsScript/Flex

Programmer Question

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!



Find the answer here

No comments:

Post a Comment

Related Posts with Thumbnails