Hi all
I have a problem with creating and then populating a datagrid from an XML file.
The .as code below creates a dynamic accordian menu then populates it with either textArea or datagrid. However, the first dataGrid is created and populated with no problems. When the next one gets created it seems to be trying to populate it with the data from the first XML node. Which i dont want to happen
[SIZE=1][FONT=Arial]
private function createDocumentation():void {
for (var i:int = 0; i < generatorProperties.documentation.length; i++) {
var c:Canvas = new Canvas();
var vbox:VBox = new VBox();
c.percentWidth = 100;
c.percentHeight = 100;
c.label = generatorProperties.documentation*.heading;
vbox.percentWidth = 96;
for (var j:int = 0; j < generatorProperties.documentation*.sections.length; j++) {
if (generatorProperties.documentation*.sections[j].image.substr(0,6) != 'TABLE_') {
var t:TextArea = new TextArea();
t.percentWidth = 100;
t.id = 'test_' + i + '_' + j;
t.enabled = false;
t.text = generatorProperties.documentation*.sections[j].information;
vbox.addChild(t);
} else {
var tableInformation:XML = new XML(generatorProperties.documentation*.sections[j].information);
var dgataGrid = new DataGrid();
dg.percentWidth = 100;
dg.dataProvider = tableInformation.row;
vbox.addChild(dg);
}
}
c.addChild(vbox);
generatorProperties.documentationAccordian.addChil d©;
}
}[/FONT][/SIZE]
Below is an extract of the that i would like to populate the accordian with
[SIZE=1][FONT=Arial]<section_4 title=“Customizing iGallery With Actionscript”>
<para_1 image="">As well as using the attributes in the xml and setting parameters in the component inspector. Further control can be added to the iGallery with Actionscript by calling methods, setting properties and creating responders for events.</para_1>
<para_2 image="">The following is a list of methods, events and properties :</para_2>
<para_3 image=“TABLE_METHOD”>
<row a=“iGallery.loadXML(‘xmlfile’)” d=“Loads xmlfile into gallery” />
</para_3>
<para_4 image=“TABLE_EVENT”>
<row a=“onLoadFinished” d=“Triggered when xml file loads and before styles applied. <br /> evtObj.pics is an array of objects, each contains pic and caption” />
<row a=“onStylesFinished” d=“Triggered when xml file defines styles. <br /> evtObj.styles is an object containg all styles” />
<row a=“onThumbLoaded” d=“Triggered when thumbnail finishes loading. <br /> evtObj.thumb is reference to thumbnail” />
<row a=“onThumbOver” d=“Triggered when thumbnail is rolled over. <br /> evtObj.thumb is reference to thumbnail” />
<row a=“onThumbOut” d=“Triggered when thumbnail is rolled out. <br /> evtObj.thumb is reference to thumbnail” />
<row a=“onThumbPress” d=“Triggered when thumbnail is clicked. <br /> evtObj.thumb is reference to thumbnail” />
</para_4>
<para_5 image=“TABLE_PROP”>
<row a=“autoLoadXML” d=“Boolean :: Determines if xml is loaded when component loads. Default - true. <br /> Should be set to false when invoking iGallery.loadXML()” />
<row a=“disableThumbs” d=“Boolean :: Determines if default rollover effects are used. Default - false. <br /> Set to true when setting custom rollovers using onThumbOver and onThumbOut” />
<row a=“defaultXML” d=“String :: Default xml file for gallery to use. Default - iGallery.xml.” />
</para_5>
</section_4>[/FONT][/SIZE]
Basically, when a ‘para’ node has an image that begins with ‘TABLE_’ then i wish to have a datagrid created that gets populated with the row nodes.
If anyone can help, or anyone is willing to help, but cannot understand what i have attempted to describe, please let me know and i will try and get a link up for you to check.
Thanks