The following code is working for me. Note the "resultFormat" attribute in HTTPService tag, as well as the "@" in front of name to access an xml node attribute.


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script>
        <![CDATA[
            public function rec():void {
                trace ([EMAIL PROTECTED]);
            }
        ]]>
    </mx:Script>
   
    <mx:HTTPService id="srv" url="" useProxy="false" resultFormat="e4x"/>
    <mx:Model id="activityModel">{srv.lastResult}</mx:Model>
   
    <mx:VBox>
        <mx:Button label="load" click="srv.send()"/>
        <mx:Button label="trace" click="rec()"/>
    </mx:VBox>
</mx:Application>


Best
X.

On 6/3/06, codeintime <[EMAIL PROTECTED] > wrote:
Hi

I have an xml file eg:

<?xml version="1.0" encoding="utf-8"?>
<activity title="Classification">
<categories>
<category name="Category 1 updated" />
<category name="Category 2" />
</categories>
</activity>

I load xml via a httpservice and place in a model:
<mx:HTTPService id="srv" url="" useProxy="false"/>
<mx:Model id="activityModel">{srv.lastResult.activity }</mx:Model>

Now I'd like to use Actionscript to get the 1st category eg
cat1.title = activityModel.categories.category[1].name;

This gives an invalid index error.

Any ideas?

Thanks






------------------------ Yahoo! Groups Sponsor --------------------~-->
Protect your PC from spy ware with award winning anti spy technology. It's free.
http://us.click.yahoo.com/97bhrC/LGxNAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to