var artData:XML = new XML(<art>
       <bios>
               <artistBio f="Peter" s="Agrafiotis">an artist</artistBio>
               <artistBio f="Larry" s="Denning">He sucks</artistBio>
               <artistBio f="Susan" s="Agrafiotis">She rocks</artistBio>
       </bios>
</art>);


var lastName="Agrafiotis";

// undefined
var a = artData.bios.artistBio.(@s==lastName);

// correctly finds the Peter Agrafiotis node
var b = artData.bios.*.(@s==lastName);

trace(a);
trace(b);

this works for me.

On Fri, Feb 5, 2010 at 10:06 AM, Mendelsohn, Michael <
[email protected]> wrote:

> Sorry folks, that was a typo in the post.  In my Flash file, it is indeed
> correctly formed XML.
>
> var e = artData.bios.artistBio.(@s==lastName);
>
> var d = artData.bios.*.(@s==lastName);
>
> There is something definitely weird going on in my code, because this is a
> simple E4X statement.  Seriously, shouldn't e and d both return the one node
> that fits that criteria?  In my class, e returns undefined, and d correctly
> returns it.
>
> - MM
>
>
> -----Original Message-----
> From: [email protected] [mailto:
> [email protected]] On Behalf Of Jer Brand
> Sent: Friday, February 05, 2010 12:16 PM
> To: Flash Coders List
> Subject: Re: [Flashcoders] E4X, it's just not my day.
>
> Fixing that, your code works (I just added explicit var types).
>
> var artData:XML = new XML(<art>
>                               <bios>
>                                       <artistBio f="Peter"
> s="Agrafiotis">an artist</artistBio>
>                                       <artistBio f="Larry" s="Denning">He
> sucks</artistBio>
>                                       <artistBio f="Susan"
> s="Agrafiotis">She rocks</artistBio>
>                               </bios>
>                        </art>);
>
>
>                        var lastName:String="Agrafiotis";
>
>                        var a:XMLList =
> artData.bios.artistBio.(@s==lastName);
>                        trace(a.toXMLString())
>
>                        var b:XMLList = artData.bios.*.(@s==lastName);
>                        trace(b.toXMLString()) ;
>
>
> OUTPUTS:
>
> <artistBio f="Peter" s="Agrafiotis">an artist</artistBio>
> <artistBio f="Susan" s="Agrafiotis">She rocks</artistBio>
> <artistBio f="Peter" s="Agrafiotis">an artist</artistBio>
> <artistBio f="Susan" s="Agrafiotis">She rocks</artistBio>
>
>
> Jer
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to