Search code examples
apache-flexnullreferenceexceptiontabnavigator

Null Reference in Flex


Ok I am working with a TabNavigator. I am populating labels, for now, in each tab. I can populate ard.text with no issue. But all my other labels come across as null and I get a 1009 error "Cannot access a property or method of a null object reference". Is there something that I am missing on what is capable with the TabNavigator. FYI I am new to Flex. Not to sure why I am getting error. Any help would be great.

<mx:TabNavigator id="tabNavigator" width="100%" height="125"  visible="false" includeInLayout="false" creationPolicy="auto">
        <mx:VBox id="generalInformation" label="Gen. Info." width="100%" horizontalAlign="center">
            <mx:Label id="ard" text=""> </mx:Label>
            <mx:Label id="bufferDist" text=""/>
            <mx:HBox paddingBottom="5" >
                <mx:Button id="googleButton" label="Google Directions" click="newWin('http://www.maps.google.com/?q=' + addressResult)"/>
                <mx:Button id="mapquestButton" label="MapQuest Directions" click="newWin('https://www.mapquest.com/?q=' + addressResult)"/>
            </mx:HBox>
        </mx:VBox>
        <mx:VBox id="schoolDistrict" label="School District" width="100%">
            <mx:Label id="schoolDistrictLabel" text=""> </mx:Label>
        </mx:VBox>
        <mx:VBox id="paHouse" label="PA House" width="100%">
            <mx:Label id="paHouseLabel" text="">    </mx:Label>
        </mx:VBox>
        <mx:VBox id="paSenate" label="PA Senate" width="100%">
            <mx:Label id="paSenateLabel" text="">   </mx:Label>
        </mx:VBox>
        <mx:VBox id="usHouse" label="US House" width="100%">
            <mx:Label id="usHouseLabel" text="">    </mx:Label>
        </mx:VBox>
    </mx:TabNavigator>

Solution

  • Never mind I figured it out. Just had to set creationPolicy to all