Flex Error #1009: Cannot access a property or method of a null object reference

后端 未结 1 1531
北海茫月
北海茫月 2021-01-28 17:10

I am trying to use a button in my init() method.




        
相关标签:
1条回答
  • 2021-01-28 18:00

    Actually it does matter. One thing about NavigatorContent (assuming your children are a subset of one of these types of containers) to remember along with their halo counterparts is they all have a content creation policy set to deferred - meaning it creates the parent most layer of the view / viewstack, but not it's children until the user has actually navigated to that particular child. One cheat is to set the policy to 'ALL', but the better way is to actually listen for the FlexEvent.CONTENT_CREATION_COMPLETE instead (this is broadcast from the child of the navigation container).

    Eg:

    <halo:ViewStack id="setupStack" width="100%" height="100%">
        <api:FileSelector width="100%" height="100%" owner="{this}" 
                          enumerationMode="{FileSystemEnumerationMode.DIRECTORIES_ONLY}"
                          hint="{networkDbAccessHint}" />
        <!- this is valid, but not it's children until contentCreateComplete is fired -->
        <api:DataImport width="100%" height="100%" owner="{this}" />
    </halo:ViewStack>
    

    Both 'FileSelector' and 'DataImport' broadcast the event (extends s:NavigatorContent).

    0 讨论(0)
提交回复
热议问题