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 ar开发者_如何学Goray 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
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
}
}
精彩评论