Ok i've written some code for a datagrid that will be populated with a list of titles from an xml file.
the xml file contains a list of articles which have 3 properties, a title, a body of text and an image.
so the datagrid is populated with the titles properties of the xml file, and i want the user to be able to click on the title they want and then click a "GO" button at the bottom of the page, and then the movie moves to the "article viewer" page, with the text fields filled out with the title and body of the corresponding article.
the problem i'm having is in the clickHandler when the user clicks on a cell.
how do i find which title the user has chosen, im fairly sure once i know that i can move forward.
import flash.events.Event;
import flash.net.URLRequest;
import flash.net.URLLoader;
import fl.data.DataProvider;
import fl.events.ListEvent;
var articlesXML:XML;
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
xmlLoader.load(new URLRequest("flash_stuff/articles.xml"));
grid.addEventListener(ListEvent.ITEM_CLICK, clickHandler);
function xmlLoaded(evt:Event):void
{
articlesXML = new XML(xmlLoader.data);
var componentProvider:DataProvider = new DataProvider();
for(var i:uint = 0; i< articlesXML.article.length(); i++ )
{
componentProvider.addItem({Articles:articlesXML.article[i].@titl});
}
grid.dataProvider = componentProvider;
}
function clickHandler(e:ListEvent):void
{
}
this code is located in frame 1 of the ArticleChooser section of the movie.
I hope someone can help
Since no replies to that yet, if anyone can think of a simpler way of acheiving what i want that would be equally fine. I just want the user to be able to read an xml file of articles and generate a list which the user can then choose from. This action will then populate text fields in a different slide for the user to read.
maybe this will solve your problem
http://www.kirupa.com/forum/showthread.php?301342-AS3-DataGrid-and-Ind ividual-Cell-Information
North America
Europe, Middle East and Africa
Asia Pacific