Have you tried setting 'width' on the List? e.g.,
s:List width=300 dataProvider={this.items}
Tim
On Mon, Jan 11, 2010 at 10:49 AM, r_woess r_wo...@yahoo.de wrote:
Hi,
here you can see a simple example with a horizontal list. after adding text
into the textinput and pressing enter, new items will be added to the list.
the with of the list automatically grows, if you add more items. but i can't
find a way, to set the with correctly, if the width is lower than the
default width. is there a possibilty to set the width correctly?
if no item is in the list, it should be 0px
if 1 item is in the list, it should be the with of the first item
and so on .
?xml version=1.0 encoding=utf-8?
s:Application xmlns:fx=http://ns.adobe.com/mxml/2009;
xmlns:s=library://ns.adobe.com/flex/spark
xmlns:mx=library://ns.adobe.com/flex/halo width=100% height=100%
fx:Script
![CDATA[
import mx.collections.ArrayCollection;
[Bindable] private var items:ArrayCollection=new ArrayCollection();
private function addItem():void
{
this.items.addItem(this.tiItem.text);
this.tiItem.text=;
}
]]
/fx:Script
fx:Declarations
!-- Place non-visual elements (e.g., services, value objects) here --
/fx:Declarations
s:HGroup width=100% height=100%
s:List dataProvider={this.items}
s:layout
s:HorizontalLayout/
/s:layout
s:itemRenderer
fx:Component
s:ItemRenderer
s:layout
s:HorizontalLayout/
/s:layout
s:Label text={data}/
s:Label text= /
/s:ItemRenderer
/fx:Component
/s:itemRenderer
/s:List
s:TextInput id=tiItem enter=this.addItem();/
/s:HGroup
/s:Application