PDA

View Full Version : Update Datagrid with AS object/variables?


leeharris100
03-06-2008, 02:41 PM
Hi,

I've been searching around for a good AS/Flex forum to join for a while because I just hopped into the world of Flex a few days ago.

I came across this problem and I've been tearing my hair out trying to figure out how to fix it. I have tried several methods that I thought would work (even the ghetto rigged methods) and it never works.

I'd like to update my Datagrid with a variable (an XMLDocument) that is dynamically changed through Actionscript code. I have it set to this right now:

<mx:DataGrid id="dataGrid" width="100%" dataProvider="{xmlClient.xmlMatchList}" >

I get the compile warnings:

Data binding will not be able to detect assignments to "xmlClient".
Data binding will not be able to detect assignments to "xmlMatchList".

The xmlClient instance is public as well as the xmlMatchList variable. I looked into it and I found out that apparently variables inside packages aren't accessible to mxml elements. I figured I could solve this by doing:

public var xml2:XMLDocument = new XMLDocument(xmlClient.xmlMatchList);

But that doesn't work because then I get the same error:

Data binding will not be able to detect assignments to "xml2".

I may be completely backwards on this, but is there any way to get MXML elements to use an Actionscript object as their datasouce?

Thanks!