views:

356

answers:

1

Hi, I have an xml file (externally saved) that is similar to the following:

[root]
  [main]
    [title]...[/title]
    [content]...[/content]
  [/main]
  [main]
    [title]...[/title]
    [content]...[/content]
  [/main]
[/root]

*All <> is replaced with [].

What I like to do is to get what's in [title] tag using HTTPservice, import it into Flex, and save it as array objects, and do the same thing for [content]. This way I can later refer the array object saying title[0] or content[2].

I'm really new to Flex so your complete example is really appreciated.

LuckySamurai

+1  A: 

flex using httpService with result event

<mx:HTTPService url="http://yours.com/caption.xml" resultFormat="e4x" id="xmlCaption" result="createCaptionArray(event)"/>

as3

        private function createCaptionArray(event:ResultEvent):void {
                            captionXML = new XML (event.result);

                            for each (var item:XML in captionXML.caption) {
                            // what ever u want to do here

                            }
        }
Abu Aqil