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.
No it isn't empty. I think States are broken. If I do the following:
<s:HGroup id="listHolder" width="100%" height="100%">
width="150" height="100" maxHeight="100"
visible="false" width="0" width.default="0" width.showSecondListState="150"
height="100" maxHeight="100" width.showThirdListState="150"
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.
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.
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.
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.