Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 07-06-2012, 07:23 PM   #1
Trent Harris
Registered User
 
Join Date: May 2012
Posts: 8
Default [AS3] Posting Parsed Data into Datagrid

Hello Everyone-

I have been working on this for a few weeks now and cannot seem to figure it out. I have a flash movie that reads an xml file and parses it. I am able to parse the data and when I run a trace the xml is coming through as requested. I am having difficultly getting the parsed data into a datagrid. Below is the script I am using.


stop();

import fl.controls.DataGrid;
import fl.data.DataProvider;

var dpataProvider;
var myDataGridataGrid = new DataGrid();
myDataGrid.addColumn("employeeid");
myDataGrid.addColumn("type");
myDataGrid.addColumn("style");
myDataGrid.addColumn("size");
myDataGrid.addColumn("length");
myDataGrid.addColumn("assigndate");
myDataGrid.setSize(350, 350);
myDataGrid.width=700;
myDataGrid.move(50, 110);
addChild(myDataGrid);

var myLoader:URLLoader=new URLLoader ;
var xmlData = new XML();

myLoader.addEventListener(Event.COMPLETE, LoadXML);
myLoader.load(new URLRequest("XML_WIN_Data.xml"));

function LoadXML(e:Event):void {
xmlData=new XML(e.target.data);
parse(xmlData);
}

function parse(Input:XML):void {
var dataroot:XMLList=Input.XML_WIN_Data.children();
var Attributes:XMLList=Input.XML_WIN_Data.attributes() ;
var List:XMLList = Input.XML_WIN_Data.(employeeid == ID);
trace(List);

dp = new DataProvider(List);
myDataGrid.dataProvider = dp;


}

BackButton.addEventListener(MouseEvent.CLICK,Backb utton);

function Backbutton (event:MouseEvent):void
{
gotoAndPlay("1");
}



The script works up through the "trace(List)" it is after that i am having trouble.

I have tried this:

dp = new DataProvider(List);
myDataGrid.dataProvider = dp;

and it does not work.

Any help would be great. I think I have everything I need it just need a little help posting the parsed data to the datagrid.

Thanks for any assistance you can provide. I can email the flash files if it would be easier to work with.

Thanks

Trent
Trent Harris 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 Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:08 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.