Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-07-2006, 07:15 PM   #1
diego.gomes
Registered User
 
Join Date: Jun 2006
Posts: 1
Default Add an item to a list.

Hi,

I would like to know how can I make a function that adds the selected combo box element to a list component, when I click on a button. I tried the MyFirstFlexApp example but it doesn't work.

Thankx!
diego.gomes is offline   Reply With Quote
Old 06-18-2006, 01:07 PM   #2
nirth
Member
 
Join Date: May 2006
Posts: 46
Send a message via ICQ to nirth Send a message via AIM to nirth Send a message via MSN to nirth Send a message via Yahoo to nirth Send a message via Skype™ to nirth
Default

Quote:
Originally Posted by diego.gomes
Hi,

I would like to know how can I make a function that adds the selected combo box element to a list component, when I click on a button. I tried the MyFirstFlexApp example but it doesn't work.

Thankx!
try this one
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" verticalAlign="middle" horizontalAlign="center" layout="vertical">
	<mx:Script>
		<![CDATA[
			[Bindable]
			private var comboDP:Array = [{label:'label:a',data:0},{label:'label:b',data:1},{label:'label:b',data:2},
										      {label:'label:d',data:3},{label:'label:e',data:4},{label:'label:f',data:5},
										      {label:'label:g',data:6},{label:'label:h',data:7},{label:'label:i',data:8},
										      {label:'label:j',data:9}];
			[Bindable]
			private var listDP:Array = new Array();
			private function onComboChange():void
			{
				listDP.push(comboDP[combo.selectedIndex]);
				list.dataProvider = listDP;
			}
		]]>
	</mx:Script>
	<mx:ComboBox id="combo" dataProvider="{comboDP}" change="onComboChange();" />
	<mx:Spacer height="50" />
	<mx:List  dataProvider="{listDP}" id="list" />
</mx:Application>
but i have some problem with binding data, list component does not want to update it...but it can be used as simplest example
__________________
OrangeBlog finally in english, but really bad one
nirth is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
List adds duplicate item i cant delete Israfel Components 2 08-04-2007 06:10 AM
List component, drag item mwmitchell Components 1 06-13-2006 05:19 PM
Selecting item in a List or Tree component- without clicking timtoady Components 0 09-14-2005 11:14 PM
knowing which item in a list that is selected? Clox ActionScript 2.0 12 09-01-2005 01:21 PM
setting a list box item as selected without selecting it brolife Components 4 03-21-2005 03:59 AM


All times are GMT. The time now is 08:32 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.