2 Replies Latest reply on Aug 20, 2007 6:55 PM by ntsiii

    setting label text

    vtxr1300 Level 1
      I have a tabnavigator and in tab 1 is a tree control. When a node in the tree is clicked I'm trying to switch to tab 2 and set the text of a label in tab 2. It does switch to tab 2 but when I try to assign the value of the label text I get the error...

      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at TrainingVideos/::LoadTopicInfo()
      at TrainingVideos/__trTopics_change()
      at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.core::UIComponent/dispatchEvent()
      at mx.controls.listClasses::ListBase/mx.controls.listClasses:ListBase::mouseUpHandler()
      at mx.controls::List/mx.controls:List::mouseUpHandler()
      at mx.controls::Tree/mx.controls:Tree::mouseUpHandler()

      What's interesting is if I go back to tab 1 and click another node, from then on it works fine. I've tried a couple of things but neither seem to work. I've set up a string variable equal to the text of the selected node and then when I switch to tab 2, I set the text equal to the string variable. Same error. Then I thought that maybe until tab 2 gets into view and loads that label, I can't access it. So, to do this I set up a function to call on creationcomplete that sets the selectedindex = 1 and then = 0 so that it quickly loads tab 2 and then goes to tab 1. But, in this case it's not going back to tab 1 but instead stays on tab2. So, basically, what is the best way to set the text of a label on tab 2 from an event on tab 1? Thanks.