2 Replies Latest reply on Dec 10, 2009 4:49 AM by Gregory Lafrance

    Using another xml catalog

    derok

      Hi,

      i'm looking at an example found here in the adobde site.

      its a cell phones catalog:

       

      http://examples.adobe.com/flex2/inproduct/sdk/flexstore/flexstore.html

       

      here is the main mxml code:

       

      http://examples.adobe.com/flex2/inproduct/sdk/flexstore/srcview/index.html

       

      if you look at the end of this code you will see a declaration calling the component ProductsView, and specifying the xml catalog that it will use:

       

       <mx:HTTPService id="productService" url="data/catalog.xml"
              result="productServiceResultHandler(event)"/>

       

                  <ProductsView id="pView" label="Products" catalog="{catalog}"
                      showEffect="WipeDown" hideEffect="WipeUp"
                      />
              

      my question is:

      how can i call again the ProductsView component again and specify another xml catalog so i can have another section of products?

       

      thanks

        • 1. Re: Using another xml catalog
          e2dev Level 2

          If I understand you correctly, you just want to create a second instance of the ProductsView, correct? To do that you just type it again with new info:

           

          <!-- original instance -->

          <ProductsView id="pView" label="Products" catalog="{catalog}"
                          showEffect="WipeDown" hideEffect="WipeUp"
                          />

          <!-- second instance -->
          <ProductsView id="newView" label="2nd Products view" catalog="{newBindableData}"
                          showEffect="WipeDown" hideEffect="WipeUp"
                          />

           

          Of course, you will need to retrieve the new data and create and populate a new (bindable) variable with that data. I haven't looked at the code so I don't know if there are other issues related to the display of the ProductsView component, but this is how you can create a second instance.

          • 2. Re: Using another xml catalog
            Gregory Lafrance Level 6

            You can create another product catalog pView2 by doing this:

             

             

            <ProductsView id="pView2" label="Products" catalog="{catalog}"
              showEffect="WipeDown" hideEffect="WipeUp"/>
            


            Run the application and you will see the second Products tab.

             

            Notice in the main app file that the "catalog" ArrayCollection used to populate the catalog is generated in the productServiceResultHandler function.

             

            You may need a separate HTTPService and result handler to load another ArrayCollection, perhaps catalog2, which you use to set the pView2 "catalog" property above.

             

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


            Greg Lafrance
            www.ChikaraDev.com

            Flex Development and Support Services