Jump to content


Flash with XML, Nodes problem


  • You cannot reply to this topic
4 replies to this topic

#1 simonk

    Young Padawan

  • Members
  • Pip
  • 4 posts

Posted 30 December 2005 - 03:43 PM

Hi, Thanks for helping guys it is very much appreciated. My problem is I have this xml file below:

<shops>
<shop name="Amazon1">
<category>Books</category>
<url>http://www.amazon.co.uk</url>
</shop>
</shops>


When Im in flash mx 2004, I have used the following code:
select = myshop.childNodes[0].childNodes[0].firstChild;


It retures <category>Books</category>, where I just want the value "Books"....

Anyone could help me, Its strange.
thanks

#2 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 30 December 2005 - 05:07 PM

select = myshop.childNodes[0].childNodes[0].firstChild.attributes.category;

this should work just fine

#3 simonk

    Young Padawan

  • Members
  • Pip
  • 4 posts

Posted 31 December 2005 - 07:49 AM

No it won't work, the attributes command is suppose to use on attributes, it wont work on nodes...

View Postfunkysoul, on Dec 30 2005, 10:07 PM, said:

select = myshop.childNodes[0].childNodes[0].firstChild.attributes.category;

this should work just fine


#4 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 31 December 2005 - 11:03 AM

what about instead of attributes using nodeValue?

#5 simonk

    Young Padawan

  • Members
  • Pip
  • 4 posts

Posted 31 December 2005 - 05:15 PM

Im defeated :( I have to use attributes for all my nodes, and it works alright now. Thanks anyway ;)
Its so strange that all the tutorials were using the firstChild / childNodes[0] method to select the nodes but I just can't.

View Postfunkysoul, on Dec 31 2005, 04:03 PM, said:

what about instead of attributes using nodeValue?






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users