PDA

View Full Version : flex2 - List Component


niddc
03-10-2006, 02:11 AM
Hai..
I'm new user here..

I have try to develop my first application, but I have a problem with list component..

How do I add item/data to list component by using AS3.0?
In AS2.0 we using ListCompName.addItem(myData1,..);

I refer to this site as my first tutorial --> http://www.macromedia.com/devnet/flex/articles/first_flexapp_12.html
(it is flex1.5 tutorial) but its not working, maybe that type of function cannot be done in flex2..

niddc
03-10-2006, 02:20 AM
oppss.. I think I have pos at the wrong section.. sorry..

Tink
03-13-2006, 10:21 AM
http://livedocs.macromedia.com/labs/1/flex/langref/mx/controls/List.html

check there the the Flex 2.0 docs on the List component

webninja
03-30-2006, 04:49 PM
I am far from an expert, but I did find this code. If I understand these components correvctly, the list needs to be tied to a data provider, which can be as simple as a container like an array.

<?xml version="1.0"?>

<!-- Simple example to demonstrate the List Control -->

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="#FFFFFF">

<mx:Script>
<![CDATA[

[Bindable]
[Embed(source="FlexLogo.gif")]
public var iconSymbol1:Class;

[Bindable]
[Embed(source="shockwave.gif")]
public var iconSymbol2:Class;

[Bindable]
[Embed(source="breeze.png")]
public var iconSymbol3:Class;

[Bindable]
[Embed(source="flash.png")]
public var iconSymbol4:Class;

]]>
</mx:Script>

<mx:Panel title="List Panel" paddingTop="10">

<mx:List id="SoftwareSelection" width="280">

<mx:dataProvider>
<mx:Array>
<mx:Object label="Macromedia Flex" icon="{ iconSymbol1 }"/>
<mx:Object label="Macromedia Shockwave" icon="{ iconSymbol2 }"/>
<mx:Object label="Macromedia Breeze" icon="{ iconSymbol3 }"/>
<mx:Object label="Macromedia Flash" icon="{ iconSymbol4 }"/>
</mx:Array>
</mx:dataProvider>

</mx:List>

</mx:Panel>

</mx:Application>