Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Flex > Flex 2, 3 & 4

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 09-14-2010, 03:15 PM   #1
kingd
Registered User
 
Join Date: Sep 2010
Posts: 3
Question How to create checkboxes from ArrayCollection

I have an ArrayCollection from which I want to create checkboxes that are divided into sections with headers, like below:

Quote:
FICTION
[] The Sleeper Awakes -- H.G. Wells [] The Time Machine -- H.G. Wells
[] The Invisible Man -- H.G. Wells [] War of the Worlds -- H.G. Wells
I've tried the following, but was unable to addElements to the list. Anyone know what I can do to addElements and create the list?

Code:
...
var books:ArrayCollection = new ArrayCollection([{category: "fiction", title: "The Time Machine", author: "H.G. Wells"},...]);
	var list:List = new List();
	list.layout = new TileLayout();
	
	for (var i:int = 0; i < books.length; i++)
	{
		var checkBox:CheckBox = new CheckBox();
		checkBox.id = "book";
		checkBox.label = String(books.getItemAt(i).title);
		list.addElement(checkBox); 
// Error -- 1061: Call to a possibly undefined method addElement through a reference with static type spark.components:List.	
	}
        booksPanel.addElement(list);
kingd is offline   Reply With Quote
 


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


All times are GMT. The time now is 08:18 AM.

///
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.