RE: [Flashcoders] E4X question: finding parent

2011-05-05 Thread Mendelsohn, Michael
Thanks everyone for your responses. The real xml was actually more complicated than what I posted. Is it me? Sometimes it seems that E4X solutions are difficult to figure out. The actual solution in my project is this, where rslt is an XMLList: rslt = topics..descendants("*").(contains(XML(fi

Re: [Flashcoders] E4X question: finding parent

2011-05-05 Thread Kenneth Kawamoto
oders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Kenneth Kawamoto Sent: Thursday, May 05, 2011 11:54 AM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] E4X question: finding parent var xml:XML = ; trace(xml.pets.pet.(@name == "

Re: [Flashcoders] E4X question: finding parent

2011-05-05 Thread Kenneth Kawamoto
.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Kenneth Kawamoto Sent: Thursday, May 05, 2011 11:54 AM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] E4X question: finding parent var xml:XML = ; trace(xml.pets.pet.(@name == "Sugar")

RE: [Flashcoders] E4X question: finding parent

2011-05-05 Thread Mendelsohn, Michael
e that bit, right? - Michael M. -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Kenneth Kawamoto Sent: Thursday, May 05, 2011 11:54 AM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] E4

Re: [Flashcoders] E4X question: finding parent

2011-05-05 Thread Glen Pike
@name - will that cause problems because "name" is a property of XML nodes? if it is maybe try attribute("name") instead? On 05/05/2011 16:53, Kenneth Kawamoto wrote: var xml:XML = ; trace(xml.pets.pet.(@name == "Sugar").parent().@group); // B Perhaps you don't want to call your XML

Re: [Flashcoders] E4X question: finding parent

2011-05-05 Thread Matt Folkard
Errr, my very limited E4X knowledge now deserts me, but try: pets.pet.(@name =="Sugar").parent().@group *__ **Plastic Martians Ltd.* email: m...@plasticmartians.co.uk web:www.plasticmartians.co.uk mobile: 07763 986 485 phone: 01434 382 973 On 05/05/2011 16:5

Re: [Flashcoders] E4X question: finding parent

2011-05-05 Thread Kenneth Kawamoto
var xml:XML = ; trace(xml.pets.pet.(@name == "Sugar").parent().@group); // B Perhaps you don't want to call your XML "pets" as it's a node name as well. Kenneth Kawamoto http://www.materiaprima.co.uk/ On 05/05/2011 16:32, Mendelsohn, Michael wrote: Hi list... I'm trying to find som

RE: [Flashcoders] E4X question: finding parent

2011-05-05 Thread Mendelsohn, Michael
> childnode.parent().@group Thanks, Matt. Well, I'm getting stuck on finding the correct node then. How do I find the node in the xml, given the node I have? var myPet:XML = I get errors with a statements like these: pets..(pet.toXMLString() == myPet.toXMLString()); pets..(* == myPet); Once

Re: [Flashcoders] E4X question: finding parent

2011-05-05 Thread Nathan Mynarcik
Perhaps [code] xml..GroupNodeName [/code] should get the parent node for ya? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Re: [Flashcoders] E4X question: finding parent

2011-05-05 Thread Geografiek
Hi Michael, how about the following (not tested): var petsList:XMLList = pets.*; var sugarDaddy:XMLList = petsList.(pet name == "Sugar"); trace(sugarDaddy@group); HTH Willem van den Goorbergh On 5 mei 2011, at 17:32, Mendelsohn, Michael wrote: > Hi list... > > I'm trying to find some xml's paren

Re: [Flashcoders] E4X question: finding parent

2011-05-05 Thread Matt Folkard
parent() should do it, as in: childnode.parent() Cheers matt *__ **Plastic Martians Ltd.* email: m...@plasticmartians.co.uk web:www.plasticmartians.co.uk mobile: 07763 986 485 phone: 01434 382 973 On 05/05/2011 16:32, Mendelsohn, Michael wrote: Hi list...

Re: [Flashcoders] E4X question: finding parent

2011-05-05 Thread Matt Folkard
would help if I answer the question: childnode.parent().@group *__ **Plastic Martians Ltd.* email: m...@plasticmartians.co.uk web:www.plasticmartians.co.uk mobile: 07763 986 485 phone: 01434 382 973 On 05/05/2011 16:42, Matt Folkard wrote: parent() should d

[Flashcoders] E4X question: finding parent

2011-05-05 Thread Mendelsohn, Michael
Hi list... I'm trying to find some xml's parent attribute. I have and I want to find "B". var pets:XML = ; I can't seem to find it. Anyone know how? Thanks, - Michael M. ___ Flashcoders mailing list Flashcode

[Flashcoders] E4X question: a dependency?

2011-01-28 Thread Mendelsohn, Michael
Hi list... clickedOne returns an xmlList for me. I can't figure out why, but when I comment out the var c assignment, clickedOne returns null. I don't use var c anywhere except to prevent clickedOne from being null. How can this be possible? Thanks for any replies, - Michael M. var c:XMLLi

Re: [Flashcoders] E4X question: counting number of subnodes

2010-08-26 Thread Glen Pike
Does this behave? games.game.child("user").(length() == 3).length() On 26/08/2010 11:00, Alexander Farber wrote: Hello fellow flashcoders, I'm still struggling with my e4x problem. With Kenneth's help I've got it partly working for the cases where each game has at least 1 user node: va

Re: [Flashcoders] E4X question: counting number of subnodes

2010-08-26 Thread Alexander Farber
Thank you for the pointers, I'll read up on child() and attribute() - I've missed them in the docs somehow ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Re: [Flashcoders] E4X question: counting number of subnodes

2010-08-26 Thread Kenneth Kawamoto
I meant attribute() - attribute() and attributes() are quite different things ;) Kenneth Kawamoto http://www.materiaprima.co.uk/ On 26/08/2010 11:41, Kenneth Kawamoto wrote: You can use "elements()" (and "attributes()") to avoid getting the error, i.e. trace("Full games: " + games.game.(eleme

Re: [Flashcoders] E4X question: counting number of subnodes

2010-08-26 Thread Kenneth Kawamoto
You can use "elements()" (and "attributes()") to avoid getting the error, i.e. trace("Full games: " + games.game.(elements("user").length() == 3).length()); Kenneth Kawamoto http://www.materiaprima.co.uk/ On 26/08/2010 11:00, Alexander Farber wrote: Hello fellow flashcoders, I'm still stru

Re: [Flashcoders] E4X question: counting number of subnodes

2010-08-26 Thread Alexander Farber
Hello fellow flashcoders, I'm still struggling with my e4x problem. With Kenneth's help I've got it partly working for the cases where each game has at least 1 user node: var games:XML = ;

Re: [Flashcoders] E4X question: counting number of subnodes

2010-08-23 Thread Alexander Farber
Hello Kenneth and others, On Thu, Aug 19, 2010 at 9:05 PM, Kenneth Kawamoto wrote: > trace("Full games: " + games.game.(user.length() == 3).length()); > trace("Vacant games: " + games.game.(user.length() < 3).length()); thank you - now my Flash code is working, but my Flex code is still not work

Re: [Flashcoders] E4X question: counting number of subnodes

2010-08-19 Thread Kenneth Kawamoto
May be this is what you after? trace("Full games: " + games.game.(user.length() == 3).length()); trace("Vacant games: " + games.game.(user.length() < 3).length()); // Trace Full games: 1 Vacant games: 2 Kenneth Kawamoto http://www.materiaprima.co.uk/ Alexander Farber wrote: Hello, my server

Re: [Flashcoders] E4X question: counting number of subnodes

2010-08-19 Thread Nathan Mynarcik
Yeah you should add attributes to your game nodes to seperate them: var games:XML = ; then you can use E4X to find the actually amount of users in each game: **Pseudo Code** games.game(@id == "1").user.length(); Nathan Mynarci

Re: [Flashcoders] E4X question: counting number of subnodes

2010-08-19 Thread Glen Pike
Hi, I am not sure you can count the sub-nodes without having some sort of differentiator between parent nodes. You might have to loop through the list of games to find how many users are in each one as your tests for 2 & 3 are returning the total number of "user" nodes in the tree.

[Flashcoders] E4X question: counting number of subnodes

2010-08-19 Thread Alexander Farber
Hello, my server delivers XML data over socket, representing games, with up to 3 players in each. In my custom component I'd like to display a summary: total number of games, number of full games (3 players) number of vacant games (joinable, because less than 3 players). I've prepared a reduced

RE: [Flashcoders] E4X question

2010-02-03 Thread Merrill, Jason
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Mendelsohn, Michael Sent: Wednesday, February 03, 2010 10:51 AM To: Flash Coders List Subject: RE: [Flashcoders] E4X question Thanks for the responses... Jason: You're right...as always! :-) Having s as an attribute will make my life easier.

RE: [Flashcoders] E4X question

2010-02-03 Thread Mendelsohn, Michael
Thanks for the responses... Jason: You're right...as always! :-) Having s as an attribute will make my life easier. I was trying to do it with a tag though, because I was trying to have really clean xml, everything as tags, no attributes. My train of thought is that actually, the p tags are a

Re: [Flashcoders] E4X question

2010-02-03 Thread kennethkawam...@gmail.com
You can condense it a little: var xmllist:XMLList = xml.p.(child("s") == animal); -- Kenneth Kawamoto http://www.materiaprima.co.uk/ On 3 February 2010 15:21, Jer Brand wrote: > Give this a try -- worked for me : ) > > > var x:XML = new XML("dog id='2'>catbird id='4'>dog") ; > var animal:Strin

RE: [Flashcoders] E4X question

2010-02-03 Thread Merrill, Jason
sage- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Mendelsohn, Michael Sent: Wednesday, February 03, 2010 9:47 AM To: Flash Coders List Subject: [Flashcoders] E4X question Hi list... I can't seem to get the right E4X statem

Re: [Flashcoders] E4X question

2010-02-03 Thread Jer Brand
Give this a try -- worked for me : ) var x:XML = new XML("dogcatbirddog") ; var animal:String = "dog" ; var list:XMLList = x.p.(child('s').text()[0] == animal) ; trace(list.toXMLString()) // traces... dog dog Jer ___ Flashcoders mailing list

[Flashcoders] E4X question

2010-02-03 Thread Mendelsohn, Michael
Hi list... I can't seem to get the right E4X statement. I'm trying to get an XMLList of all the p tags that have an s tag that is a certain string. I've tried all sorts of combinations, thinking this one would work, but it doesn't: // where animal is passed "dog" var list:XMLList = XMLList(all.

RE: [Flashcoders] E4X question

2009-05-01 Thread Mendelsohn, Michael
Thanks for all the responses! I ended up adapting this solution, and I got tripped up on the fact that parent() is a method!! Ugh. - MM take the XMLList that you have and run a for each loop on it looking for a match at the name attribute for each (var element:XML in FloorPlanData.floor){

Re: [Flashcoders] E4X question

2009-04-30 Thread Muzak
quot;Mendelsohn, Michael" To: "Flash Coders List" Sent: Thursday, April 30, 2009 8:43 PM Subject: [Flashcoders] E4X question Hi list... I'm still relatively new with E4X. I can't get seem to get this function to return the name of the floor that the department

Re: [Flashcoders] E4X question

2009-04-30 Thread Gregory Boland
Mike, take the XMLList that you have and run a for each loop on it looking for a match at the name attribute for each (var element:XML in FloorPlanData.floor){ if(eleme...@name == thisLabel){ return element } } or something along those lines Hope this is what you were asking gre

RE: [Flashcoders] E4X question

2009-04-30 Thread Mendelsohn, Michael
Thanks for replying, Cor. Yes, when the xml is loaded, the Event.COMPLETE function gets fired. That part isn't the problem because I'm already doing other things with the XML. It's just this bit that I can't get an XMLList for. What really happens is Sprites within a ScrollPane component get

[Flashcoders] E4X question

2009-04-30 Thread Mendelsohn, Michael
Hi list... I'm still relatively new with E4X. I can't get seem to get this function to return the name of the floor that the department is on. I.E., pass a string, traverse the xml, get the parent's name attribute. In my second attempt, I figured to test for the property name first, because

RE: [Flashcoders] E4X question in regards to ill-formed node

2008-07-29 Thread Merrill, Jason
;Sent: Tuesday, July 29, 2008 10:50 AM >>To: Flash Coders List >>Subject: [Flashcoders] E4X question in regards to ill-formed node >> >>I am getting XML from a WSDL and one of the nodes is like so: >> >>26.95 >> >>now, how can I address this node? >

Re: [Flashcoders] E4X question in regards to ill-formed node

2008-07-29 Thread eric e. dolecki
Many thanks, that works quite nicely. Eric On Tue, Jul 29, 2008 at 11:11 AM, Ian Thomas <[EMAIL PROTECTED]> wrote: > trace(foo.descendants("P-E")); > > (Worth looking at foo.child() and foo.elements() too...) > > HTH, > Ian > > On Tue, Jul 29, 2008 at 3:50 PM, eric e. dolecki <[EMAIL PROTECTED]

Re: [Flashcoders] E4X question in regards to ill-formed node

2008-07-29 Thread Kenneth Kawamoto
One way is: trace(foo.descendants("P-E").toXMLString()); Kenneth Kawamoto http://www.materiaprima.co.uk/ eric e. dolecki wrote: I am getting XML from a WSDL and one of the nodes is like so: 26.95 now, how can I address this node? trace( foo..P-E ); won't work, how can I use E4X to reliably

Re: [Flashcoders] E4X question in regards to ill-formed node

2008-07-29 Thread Ian Thomas
trace(foo.descendants("P-E")); (Worth looking at foo.child() and foo.elements() too...) HTH, Ian On Tue, Jul 29, 2008 at 3:50 PM, eric e. dolecki <[EMAIL PROTECTED]> wrote: > I am getting XML from a WSDL and one of the nodes is like so: > > 26.95 > > now, how can I address this node? > > trace

[Flashcoders] E4X question in regards to ill-formed node

2008-07-29 Thread eric e. dolecki
I am getting XML from a WSDL and one of the nodes is like so: 26.95 now, how can I address this node? trace( foo..P-E ); won't work, how can I use E4X to reliably get that node's value if the index of it (child index) could move around within the parent nodes? Eric

Re: [Flashcoders] E4X question

2008-07-03 Thread Juan Pablo Califano
I agree with most of what you've said. I just wanted to point out that using hyphens is not sub-standard. Avoiding them is a good decision if that's up to you and you happen to use a language like AS (which lets you reference previously undefined identifiers and would cause the "-" to clash with th

Re: [Flashcoders] E4X question

2008-07-03 Thread Alias Cummins
Hi guys, First, thanks for your help. The problem is now fixed, without having to change the XML. Whenever the term "best practices" comes up in a debate, it usually becomes a big long complicated discussion. I try to avoid the term, as it implies one way of doing something is inherently better t

Re: [Flashcoders] E4X question

2008-07-03 Thread Alias Cummins
Unfortunately, telling other people to change their entire XML structure and config doesn't usually win you a lot of friends... especially on a tight deadline. Thanks, Alias 2008/7/2 Steven Sacks <[EMAIL PROTECTED]>: > You might want to try following XML standards and best practices by not > usin

Re: [Flashcoders] E4X question

2008-07-02 Thread Steven Sacks
Just because you CAN do it (as this document is just that, documentation), it doesn't mean you SHOULD. I mean, you CAN put underscores in class names. You CAN start class names with lower case characters. You can make all your variable names ALL CAPS even if they're not constants. You can p

Re: [Flashcoders] E4X question

2008-07-02 Thread Juan Pablo Califano
Even though I personally prefer to avoid hyphens too, they are standard, if W3C recommendations qualify as standards. >From the w3c xml spec: # Characters '-' and '.' are allowed as name characters. http://www.w3.org/TR/REC-xml/#xml-names Definition: A Name is a token beginning with a letter or

Re: [Flashcoders] E4X question

2008-07-02 Thread Steven Sacks
Fair enough, Rich. :) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Re: [Flashcoders] E4X question

2008-07-02 Thread Rich Shupe
I guess I wasn't clear. I said the author's question may have been posted, and the other answers may have been valuable, because the source may NOT have been within the author's power to change. On 7/2/08 6:37 PM, "Steven Sacks" <[EMAIL PROTECTED]> wrote: > Hyphens in XML node names and attribut

Re: [Flashcoders] E4X question

2008-07-02 Thread Steven Sacks
My point is that the source (XHTML) was following best practices for XHTML, including using strict mode. By contrast, the OP's source was XML, but it was not following best practices, so Flash had some issues with hyphens, which aren't supposed to be there. I guess I was just saying that it

Re: [Flashcoders] E4X question

2008-07-02 Thread Rich Shupe
I don't understand the subtleties here. Just because XHTML was following it's own rules doesn't mean it was within best practices to use AS E4X to parse it. I'm quite sure it is not considered best practice to work with HTML in XML child nodes, without either CDATA or encoded entities, and your exp

Re: [Flashcoders] E4X question

2008-07-02 Thread Steven Sacks
Just because I'm parsing XHTML using the XML parser in Flash doesn't mean that the XHTML is not following best practices. CDATA in XML is a best practice, but not in HTML. I'm using the Flash E4X parser to parse HTML, which, while technically possible, has its own set of challenges due to XML

Re: [Flashcoders] E4X question

2008-07-02 Thread Rich Shupe
He may be working with a source he can't change, like your parsing HTML without using CDATA tags. On 7/2/08 1:56 PM, "Steven Sacks" <[EMAIL PROTECTED]> wrote: > You might want to try following XML standards and best practices by not > using hyphens in XML node or attribute names. > > The only t

Re: [Flashcoders] E4X question

2008-07-02 Thread Steven Sacks
You might want to try following XML standards and best practices by not using hyphens in XML node or attribute names. The only time I've seen hyphens in XML is when salespeople and other laymen end up writing XML schemas. Why they're ever given authority to do such things is beyond me. If i

Re: [Flashcoders] E4X question

2008-07-02 Thread Kenneth Kawamoto
var xml:XML = ; trace([EMAIL PROTECTED]"some-attribute"]); trace(xml["@some-attribute"]); trace(xml.attribute("some-attribute")); Kenneth Kawamoto http://www.materiaprima.co.uk/ Alias? wrote: Hi guys, Quick E4X question. I have an XML node, with an attribute inside, the name of which contains

Re: [Flashcoders] E4X question

2008-07-02 Thread Ian Thomas
Instead of just typing [EMAIL PROTECTED] (which won't work), use the attribute() method: node.attribute("some-attribute") That should do it. HTH, Ian On Wed, Jul 2, 2008 at 5:35 PM, Alias™ <[EMAIL PROTECTED]> wrote: > Hi guys, > > Quick E4X question. > > I have an XML node, with an attribute

[Flashcoders] E4X question

2008-07-02 Thread Alias™
Hi guys, Quick E4X question. I have an XML node, with an attribute inside, the name of which contains a dash "-". How can I access the value of this node via e4x inside actionscript? FDT doesn't seem to like the concept at all... Example: I want to get the value of "some-attribute". Thanks