3 Replies Latest reply on Aug 9, 2007 1:33 PM by ntsiii

    Error accessing object inside a viewstack

    marrrrrrrc Level 1
      I'm trying to call this when the application initializes:


      public function init():void {
      rtByQueues.addEventListener(ChartItemEvent.ITEM_CLICK, queuesUpdate);

      and getting this error:


      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at template/init()
      at template/___template_Application1_initialize()
      at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.core::UIComponent/dispatchEvent()
      at mx.core::UIComponent/set processedDescriptors()
      at mx.core::Container/createComponentsFromDescriptors()
      at mx.core::Container/mx.core:Container::createChildren()
      at mx.core::UIComponent/initialize()
      at mx.core::Container/initialize()
      at mx.core::Application/initialize()
      at template/initialize()
      at mx.managers::SystemManager/ http://www.adobe.com/2006/flex/mx/internal::childAdded()
      at mx.managers::SystemManager/private::initializeTopLevelWindow()
      at mx.managers::SystemManager/private::docFrameHandler()
      at [execute-queued]

      I figured it out that its because I'm using a ViewStack and rtByQueues columnchart is inside one of those views. How can I do the above when using a viewstack like so:


      <viewstack id="views">
      <canvas id="view1">
      <columnchart id="rtByQueues">...........</columnchart>
      and so on....

      I'm using flex 3. Thanks!