1 Reply Latest reply on Jun 30, 2007 8:45 AM by savyasachi

    Complex Flex application Design question

    savyasachi
      I am new to Flex and just started working on an online retail store application.
      However I ran into an issue and I am stuck.

      Here is the structure of my application:
      I have an application file - Main.mxml and
      two modules files - LoginModule.mxml & MainModule.mxml
      and I am loading the LoginModule.mxml module by default and after a successful logon loading MainModule.mxml


      The MainModule.mxml has a viewstack similar flexstore sample
      and has the view components - Home.mxml
      Products.mxml
      ...etc.
      The Products.mxml has filter panel, product catalog panel, shopping cart panel
      (similar to ProductsView.mxml in the flexstore sample).

      Here is the issue:
      Whenever I click on a control (checkbox, combobox..etc) in the filter panel
      I get an error message as shown below:

      For check box click:
      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at mx.managers::PopUpManager$/addPopUp()
      at mx.controls::Alert$/show()
      at mbzprodsView::ProductCatalogPanel/filter()
      at GroceriesView/__filterPanel_filter()
      at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.core::UIComponent/dispatchEvent()
      at mbzprodsView::GroceryFilterPanel/::dispatchFilter()
      at mbzprodsView::GroceryFilterPanel/__cbBreadRoti_click()


      For Combobox click :
      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at mx.managers::PopUpManager$/addPopUp()
      at mx.controls::ComboBox/::getDropdown()
      at mx.controls::ComboBox/::displayDropdown()
      at mx.controls::ComboBox/mx.controls:ComboBox::downArrowButton_buttonDownHandler()
      at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.core::UIComponent/dispatchEvent()
      at mx.controls::Button/ http://www.adobe.com/2006/flex/mx/internal::buttonPressed()
      at mx.controls::Button/mx.controls:Button::mouseDownHandler()

      However, the MainModule.mxml file works OK if I convert this component to an Application file from Module.

      Not sure if this is a limitation of Flex 2 or I need to organize the files in a different way.

      Any help will be greatly appreciated.

      Thanks a lot,
        • 1. Complex Flex application Design question
          savyasachi Level 1
          Found the solution in Michael Ritchie's Blog. Thanks Michael. I wasted two weeks of my time on this issue.

          Included the below code in the script block of my application file and it solved the issue:

          <mx:Script>
          <![CDATA[
          import mx.managers.DragManager;
          import mx.managers.PopUpManager;

          public var dm:DragManager;
          public var pm:PopUpManager;
          ]]>
          </mx:Script>