Hi Ravi,
Thanks for the advice. One problem I am seeing here is that the code
coming from php doesn't like your formatting. I am not sure how to
output from php where I can specify a value, as in "sectioncode
value=1." The xml is being generated dynamicaly via a loop. Here is
the code that I am using to make the xml for Flex.
$xml="<?xml version=\"1.0\"?>";
$xml.= "<root>";
while ($row3 = mysql_fetch_assoc($result3)){
$title=$row3["title"];
$sectioncode=$row3["sectionnumber"];
$xml.= "<sectioncode>$sectioncode<labtitle>$title</labtitle></
sectioncode>";
}
}
$xml.= "</root>";
header("Content-type: text/xml");
echo $xml;
Any ideas? I would like to try and keep it as dynamic as possible
because there can be unlimited sections and titles within.
Thanks!
On Mar 12, 8:40 am, Ravi Mishra <[email protected]> wrote:
> I think you should change the format of the xml like :
>
> <root>
> <sectioncode value='1'>
> <labtitle value='Biological Materials'/>
> </sectioncode>
> <sectioncode value='2'>
> <labtitle value='Chemical Materials'/>
> </sectioncode>
> </root>
>
> and the use the following mxml code:
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
> layout="absolute" creationComplete="treeService.send();">
> <mx:HTTPService id="treeService" url="data.xml" result="resultHandler
> (event)" resultFormat="e4x"/>
> <mx:Script>
> <![CDATA[
> import mx.rpc.events.ResultEvent;
>
> [Bindable]
> private var resXML:XML = new XML()
> private function resultHandler(e:ResultEvent):void{
> resXML = e.result as XML;
> }
> ]]>
> </mx:Script>
> <mx:Tree dataProvider="{resXML..sectioncode}" labelField="@value"
> width="300"/>
> </mx:Application>
>
> HTH,
>
> -Ravi
>
> On Mar 12, 3:07 pm, Chezki Ackerman <[email protected]>
> wrote:
>
> > Hi Everyone, I am a but new to the Flex scene and need some help with
> > a tree control.
>
> > Here is the issue:
> > I have a serverside httpservice call and return with php, php returns
> > an xmllist that looks like this:
>
> > <root>
> > <sectioncode>
> > 1
> > <labtitle>
> > Biological Materials
> > </labtitle>
> > </sectioncode>
> > <sectioncode>
> > 2
> > <labtitle>
> > Chemical Materials
> > </labtitle>
> > </sectioncode>
> > </root>
>
> > I would like to bind this result to a tree control so that it displays
> > nicely for all to see but something is going wrong. When I set the
> > dataprovider of the tree to "get_sections.lastResult.sectioncode," the
> > tree forms but the first folder (which I would like to just show the
> > "sectioncode" value) shows:
> > "<sectioncode>
> > 1
> > <labtitle>
> > Biological Materials
> > </labtitle>
> > </sectioncode>"
>
> > as the folder name, then it shows "1" (which is the value that I want
> > on the folder) as an item within the folder. Beneath that, I am
> > getting the title as a folder within the first folder with the xml
> > formatting and then another object with the title in there (this
> > sounds complicated if you can't see it). I am not sure what I am doing
> > wrong becasue the xml seems to be coming back from php correctly. The
> > result I am looking for is as follows:
>
> > 1
> > Biological Materials
>
> > 2
> > Chemical Materials
>
> > I would like the titles to be a child of the "sectioncode" value, so
> > that you would have a folder with the sectioncode (1 and 2) and when
> > you click on the folder, you would see the titles within the folder.
> > Can anyone help here??
>
> > Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---