Alexander Farber wrote:

>I've traced the set data in debugger and its d argument
> is really an Object, not XML. Flash seemingly will go through all the
> 1st level children of dataProvider's XML and create an Object for
> each of them with attributes as properties (and also with sub-children
> as properties, but they will be empty strings).

That's because of the way your xml is formed. Your child nodes don't
contain any data--just attributes. If you had data, you could expand
the tree.

>      public function set data(d:Object):void {
>            _data = d;
>            id = d.id;          // works ok now, but d.user is a ""

Yes, the way you have it, d.user has no data--just attributes. Flash
is giving you accurate results.

What you really want is something like this:

<games>
     <game id="0"/>
     <game id="9012">
        <user id="OK10218913103" name="Yervand"/>
     </game>
     <game id="9013">
        <user id="OK305894249541" name="chabo"/>
        <user id="OK151358069597" name="Elena"/>
     </game>
     <game id="9007">
        <user id="DE7062" name="lexo"/>
     </game>
</games>

Then you can access your attributes with syntax like this (untested,
so you'll have to tweak it a bit):

games.ga...@id
games.gam...@id==0].user.@id
games.gam...@id=="9013"].use...@id=="OK305894249541"]

I probably have some of the syntax wrong--its untested, and I usually
make mistakes when I write it off the top of my head. That's the
general idea, though. The Flash help files have some good
examples--just look under the XML class. Or, get Colin Moock's
ActionScript 3 book, and read the chapter on XML. That's how I learned
to use the XML parser.

Cordially,

Kerry Thompson

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to