The constructor must be called to create an instance of an object. This must be done before any properties are given values i side that object.
As such, I would always expect the data property to be null in the constructor.
Read up on the Flex Component LifeCycle. Step 1 and 2 are the important points for this problem:
- You call the component’s constructor...
- You configure the component by setting its properties...
You'll have to access the data property at some point not in the constructor. Perhaps in an event listener, such as initialize or creationComplete. Perhaps as part of a lifecycle method, such as updateDisplayList() or commitProperties().