Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
| Search | Today's Posts | Mark Forums Read
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 9th, 2007, 10:06 AM
Registered User
 
Join Date: Jun 2007
Location: Plantersville, TX, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default xml and flash

ok, i have this part of a code, its pulling the xml and putting it into text boxes.

Code:
      var minorsnodes:Array = newxml.firstChild.firstChild.nextSibling.childNodes;
      for (var i:Number = 0; i < minorsnodes.length; i++) {
         // for each mode node:
         var minornode:XMLNode = minorsnodes[i];
         modes.push(
            {i:i+1,
             pname:minornode.attributes.name,
             desc:minornode.childNodes[0].attributes.name,
             desc1:minornode.childNodes[1].attributes.name,
             desc2:minornode.childNodes[2].attributes.name,
             desc3:minornode.childNodes[3].attributes.name,
             score:minornode.childNodes.childNodes[1].attributes.value
         });
         //2d array
         //xslt html
      }


this is the xml being used

Code:
<?xml version="1.0" encoding="UTF-8"?>
<scorelist version="0">
   <user>Sciandu</user>
   <game name="Harmonic Convergence Deluxe">
     <major_mode name="Race">
       <minor_mode display_mode="time" name="Asteroid">
         <score value="35" login="Sciandu"/>
       </minor_mode>
       <minor_mode display_mode="time" name="Breach">
         <score value="65" login="Sciandu"/>
       </minor_mode>
       <minor_mode display_mode="time" name="Radioactive Rose">
         <score value="24" login="Sciandu"/>
       </minor_mode>
       <minor_mode display_mode="time" name="Art">
         <score value="42" login="Sciandu"/>
         <score value="54" login="Mehh"/>
         <score value="54" login="tmp1"/>
         <score value="91" login="User1"/>
         <score value="99" login="Sciandu"/>
       </minor_mode>
     </major_mode>
     <major_mode name="Challenge">
       <minor_mode display_mode="number" name="-">
         <score value="14" login="Sciandu"/>
       </minor_mode>
     </major_mode>
     <major_mode name="Frenzy">
       <minor_mode display_mode="number" name="Camp Fire">
         <score value="79" login="Sciandu"/>
       </minor_mode>
       <minor_mode display_mode="number" name="Art">
         <score value="54" login="Sciandu"/>
       </minor_mode>
       <minor_mode display_mode="number" name="Ritual">
         <score value="59" login="tmp1"/>
         <score value="53" login="Sciandu"/>
         <score value="2" login="Mehh"/>
       </minor_mode>
     </major_mode>
   </game>
</scorelist>
what i need to do is be able to index the minor modes into one text box instead of each one having their own and index them into one, and i need to be able to index each score for each minor mode accordingly. The problem is it wont let me index if i use childNodes[i] here
Code:
desc1:minornode.childNodes[1].attributes.name,
im guessing its because its already in an index, but i dont know, can anyone help me?

  #2 (permalink)  
Old June 10th, 2007, 03:20 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Sorry I can't follow your terminology, not sure what index means and there are no textboxes. Can you show an example of what output you want? At the moment your expression newxml.firstChild.firstChild.nextSibling.childNode s seems to refer to the major_mode elements.

--

Joe (Microsoft MVP - XML)


Similar Threads
Thread Thread Starter Forum Replies Last Post
XML code in flash not geting updated sania XSLT 1 January 11th, 2006 01:38 PM
flash 8 - HTML/XML specifications Baes Flash (all versions) 0 November 11th, 2005 12:41 AM
XML and FLASH yathen XML 0 October 4th, 2004 11:48 PM
New to Flash bmains Flash (all versions) 3 July 2nd, 2004 03:08 AM
Flash XML scorpion_king XSLT 0 March 19th, 2004 09:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.