6 Replies Latest reply on Jan 15, 2012 12:37 PM by DBilodeau12

    unique clickhandler event for each list item

    DBilodeau12 Level 1

      I am trying to create a list where each item on the list will direct to a unique .mxml page.

       

      I havent seen any examples on how to do this.  Most of them seem to use an xml file and some array and just rebuild unique info on the same second page base on which spot onthe list is selected.  I need a totally separate page for each item on the list. 

       

      Hope the question makes sense! 

       

      Thanks

        • 1. Re: unique clickhandler event for each list item
          DonMitchinson Level 2

          Should be fairly simple if you build your mxml filenames based on the index of the list array items -eg 1.mxml, 2.mxml

          or if you want it to be easier to modify and not based on the position in the array, the filenames can be based

          on an item in the dataprovider.

           

          Then you add the select mxml code to the list's changeHandler.

           

          If this is Greek to you, supply some of your example code for the data in the data provider, and what you want the filenames

          to be keyed on in the list

          • 2. Re: unique clickhandler event for each list item
            DBilodeau12 Level 1

            Thanks for the response!  Is there something I have to do so that the file names dont just end up as text? 

             

            Thanks!

            • 4. Re: unique clickhandler event for each list item
              DBilodeau12 Level 1

              I guess I dont understand your suggestion.  How do I add the file names to an array so that they do not appear in the list just as text but rather a function to transition to another page?

               

              I am a bit of a newbie with Flex!  If you can direct me to a good example that would be great.

               

              Thanks!

              • 5. Re: unique clickhandler event for each list item
                DonMitchinson Level 2

                Have you started a project?

                 

                Do you have a list of mxml filenames that you want to open from the list?

                 

                Can you preload an ArrayCollection of these filenames? There should be plenty of examples of that online.

                 

                Have you added a combobox or listbox to your project yet?

                • 6. Re: unique clickhandler event for each list item
                  DBilodeau12 Level 1

                  This is what I have

                   

                  <?xml version="1.0" encoding="utf-8"?>

                  <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"

                                      xmlns:s="library://ns.adobe.com/flex/spark" title="Family Law Statutes"

                                      creationComplete="srv.send()">

                   

                            <fx:Declarations>

                                      <s:HTTPService id="srv" url="assets/StatuteList.xml"/>

                            </fx:Declarations>

                   

                            <s:List id="list" top="0" bottom="0" left="0" right="0"

                                                dataProvider="{srv.lastResult.list.employee}"

                                                change="navigator.pushView(StatuteDetails, list.selectedItem)">

                   

                                      <s:itemRenderer>

                                                <fx:Component>

                                                          <s:IconItemRenderer

                                                                    label="{data.firstName} {data.lastName}"

                                                                    messageField="title"/>

                                                </fx:Component>

                                      </s:itemRenderer>

                   

                            </s:List>

                   

                  </s:View>

                   

                  It doesnt go to a different .mxml  page for each list item, instead it just uses one page and rebuilds different info on it depending on what list item is selected.  I want to go to a toally different page on each list item. 

                   

                  Thanks!