Join Login


Video Tutorials
Blog



Yahoo! Small Business

DataGrid Component


By: RiverCityGraphix      Views: 3126      Share: Bookmark and Share

In this tutorial, you will learn how to use the DataGrid component in Flash CS4.

The DataGrid Component is very useful for displaying events or other data in an organized manner. You can create columns and rows allowing for an almost spreadsheet type widget within Flash. Remember that the DataGrid is used to show data rather than layout content. Some great applications for this component include schedules, event listings, calendars, etc.

ActionScript 3.0
var event1:Object = { Date:"July 15, 2010", Time:"5:30pm", Location:"New York City, NY" };
var event2:Object = { Date:"August 21, 2010", Time:"6:00pm", Location:"St. Louis, MO" };
var event3:Object = { Date:"August 29, 2010", Time:"6:30pm", Location:"Los Angeles, CA" };
var event4:Object = { Date:"September 30, 2010", Time:"7:00pm", Location:"San Antonio, TX" };

datagrid.columns = ["Date", "Time", "Location"];
//datagrid.columns[0].width = 120;
//datagrid.columns[1].width = 70;
datagrid.resizableColumns = true;

datagrid.addItem(event1);
datagrid.addItem(event2);
datagrid.addItem(event3);
datagrid.addItem(event4);

datagrid.addEventListener(Event.CHANGE, griditemselected);

function griditemselected (event:Event):void{
mytxt.text = "You want to attend the concert on " + event.target.selectedItem.Date + " at " + event.target.selectedItem.Time + " in " + event.target.selectedItem.Location + ".";
}




Free Source Files Zip

Adobe Master Collection CS5.5