3 Replies Latest reply on Dec 29, 2009 11:45 AM by cheftimo

    Trigger ComboBox change handler before application displays

    cheftimo Level 2

      I have a ComboBox in a foods catalog, with has a list of categories, say, like this:


      All Categories





      All categories are loaded at first, then, on the change event in the ComboBox, the food catalog is filtered and only foods in the selected category are displayed.


      I want to eliminate the "All Categories" choice and just have the other three options in the ComboBox – On initial display, the ComboBox selectedItem would be Meats (selectedIndex = 0) but all the catalog items appear because the entire catalog is created on Application creationComplete.



      • The ComboBox is in a custom component.
      • The change handler is defined in that same component.



      So, what I really need is to trigger that change handler before the display appears.


      How do I achieve this?


      Any ideas would be greatly appreciated.



        • 1. Re: Trigger ComboBox change handler before application displays
          cheftimo Level 2

          Nobody has run into a similar issue?



          • 2. Re: Trigger ComboBox change handler before application displays
            Gregory Lafrance Level 6

            If this post answers your question or helps, please mark it as such.

            Greg Lafrance

            Flex Development, Training, and Support Services

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
                  import mx.events.ListEvent;
                  private function changeFunc(evt:ListEvent):void{
                      case "All Categories":
                      case "Meats":
                      case "Fish":
                      case "Pasta":
              <mx:ComboBox id="cmbx" change="changeFunc(event);"
                creationComplete="cmbx.selectedItem='Meats';cmbx.dispatchEvent(new ListEvent(ListEvent.CHANGE))">
                  <mx:String>All Categories</mx:String>
              <mx:ViewStack id="vs">
                <mx:VBox id="all" width="300" height="200" backgroundColor="0x000000"/>
                <mx:VBox id="meats" width="300" height="200" backgroundColor="0xFFFFFF"/>
                <mx:VBox id="fish" width="300" height="200" backgroundColor="0x0000FF"/>
                <mx:VBox id="pasta" width="300" height="200" backgroundColor="0xFF0000"/>
            • 3. Re: Trigger ComboBox change handler before application displays
              cheftimo Level 2

              Hi Greg, thanks for replying. Unfortunately, this will not work for what I want to do; I guess you need more information than what I gave in the original post.


              The application I am working on will be similar to the Flexstore app, which I assume you are familiar with, since there is a link to it on ChikaraDev.com


              I am in a very preliminary stage in this, but here is some more info:


              My project will have 1,100+ products, 24 categories, with number of products in each category ranging from 1 to 486;

              The data will come from a database through a ColdFusion cfc, not from XML;

              The images will come from the merchant's server.


              I realize I may have to use one or more modules and split the categories into groups because the app in its present form is very slow and often crashes.


              But for now (see the Flextore app), I just would like to eliminate that "All Series" from the top of that ComboBox list, but still load all the images.


              If you want to play with this for a while, go for it. And you may have some ideas/suggestions; if so, I would love to hear them.


              Best regards,