Skip navigation
Currently Being Moderated

Datagrid headache

Apr 23, 2012 10:52 AM

Tags: #problem #flash #as3 #cs5.5 #event #actionscript3 #actionscript_3.0

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

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points