5 Replies Latest reply on Nov 2, 2010 10:59 AM by Flex harUI

    Creating a s:list via AS3 doesn't show the data?

    flairjax Level 1

      If I do something like this below the list shows up on the screen but the items in the dataprovider don't show up.  If I throw the List in via MXML tags it shows up fine.  Any suggestions?  And yes, I know the data is there as it works when using an MXML version of the list.

       

                      var thirdList:List = new List();
                      thirdList.dataProvider = someDataProvider;
                      thirdList.useVirtualLayout = true;
                      third.addElement(thirdList);

       

      TIA

        • 1. Re: Creating a s:list via AS3 doesn't show the data?
          pauland Level 4

          Use the debugger (or trace statements) to check whats in the dataProvider at the time this code runs. I'd guess the dataProvider is empty.

          • 2. Re: Creating a s:list via AS3 doesn't show the data?
            flairjax Level 1

              No it isn't empty.  I think States are broken.  If I do the following:

             

            <s:HGroup id="listHolder" width="100%" height="100%">

             

                    <s:List id="initialList"

             

                             width="150" height="100" maxHeight="100"

             

                             change="onInitialListSelection(event)" />

             

             

             

                    <s:List id="secondList"

             

                             visible.showSecondListState="true"

             

                             visible="false" width="0" width.default="0" width.showSecondListState="150"

             

                             height="100" maxHeight="100" width.showThirdListState="150"

             

                             change="onSecondListSelection(event)" />

             

             

             

                    <s:List id="thirdList"

             

                            excludeFrom="default" "

                            dataProvider="{someHardCodedDataIthatIsNeverEmpty}"

                            change="onSecondListSelection(event)" />

             

                </s:HGroup>

             

            When the thirdList is shown, meaning the state is not in default, the space where thirdList should show up expands like the s:List is there, but it visually isn't shown.

            • 3. Re: Creating a s:list via AS3 doesn't show the data?
              CoreyRLucier Adobe Employee

              You started out the thread saying that a list wasn't showing up when created with AS3. But then you post saying it's not working with states.

               

              Which is it?  If you could post a full non-working example folks can better help diagnose.

               

              Thanks,

               

              C

              • 4. Re: Creating a s:list via AS3 doesn't show the data?
                flairjax Level 1

                I can't post my code, company policy, but create a Flex 4 Application (with states) --> a component (with states) ---> anotherComponentMyHGroupAbove(with states).  Try creating the lists in anotherComponentMyHGroupAbove via AS3.  See what you get.

                 

                I have found that if I assign a dataprovider to my s:Lists and set this dataProvider dynamically the s:List will only show the first item in the dataProvide, when run without debug mode.  BUT, if I do the same thing and run it in debug mode, and walk throught the code slowly the s:List get populated with all the data.  It seems as if the updating UI happens to fast or the data being injected via, dataProvider, is to slow.  Only slowing the app down via debug does it run correctly.

                • 5. Re: Creating a s:list via AS3 doesn't show the data?
                  Flex harUI Adobe Employee

                  The debugger will cause getters to run that normally don't.  Try creating a

                  new simple project and post that.  It will also eliminate the possibility of

                  side-effects from the rest of your app.