Foros del Web

Foros del Web (http://www.forosdelweb.com/)
-   Programación General (http://www.forosdelweb.com/f14/)
-   -   acceder a los nodos de un xml desde flash (http://www.forosdelweb.com/f14/acceder-nodos-xml-desde-flash-293209/)

nadal83 28/04/2005 10:38

acceder a los nodos de un xml desde flash
 
hola a todos, quiero acceder desde flash a los nodos de un xml, ahora os explico.
tengo el siguiente código xml:
Código:

<?xml version="1.0" encoding="iso-8859-1"?>
<datos>
        <botones>
                <boto0>
                        <repos>
                                <general>
                                        <setRGB>0xFF0000</setRGB>
                                        <_x>0</_x>
                                        <_y>0</_y>
                                        <_width>150</_width>
                                        <_height>75</_height>
                                       
                                </general>
                                <text>
                                        <text>Marcel</text>
                                        <font>verdana</font>
                                        <fontColor>0xFFFFFF</fontColor>
                                        <italic>1</italic>
                                        <bold>1</bold>
                                        <underline>0</underline>
                                        <align>Center</align>
                                        <size>22</size>
                                        <_x>0</_x>
                                        <_y>0</_y>
                                        <_width>150</_width>
                                        <_height>75</_height>
                                </text>       
                        </repos>
                        <sobre>
                                <general>
                                        <setRGB>0xFFFF00</setRGB>
                                        <_x>0</_x>
                                        <_y>0</_y>
                                        <_width>150</_width>
                                        <_height>75</_height>
                                       
                                </general>
                                <text>
                                        <text>Marcel</text>
                                        <font>verdana</font>
                                        <fontColor>0x000000</fontColor>
                                        <italic>1</italic>
                                        <bold>1</bold>
                                        <underline>0</underline>
                                        <align>center</align>
                                        <size>22</size>
                                        <_x>0</_x>
                                        <_y>0</_y>
                                        <_width>150</_width>
                                        <_height>75</_height>
                                </text>       
                        </sobre>
                        <pulsat>
                                <general>
                                        <setRGB>0x0000FF</setRGB>
                                        <_x>0</_x>
                                        <_y>0</_y>
                                        <_width>150</_width>
                                        <_height>75</_height>
                                       
                                </general>
                                <text>
                                        <text>Marcel</text>
                                        <font>verdana</font>
                                        <fontColor>0xFFFFFF</fontColor>
                                        <italic>1</italic>
                                        <bold>1</bold>
                                        <underline>0</underline>
                                        <align>center</align>
                                        <size>22</size>
                                        <_x>0</_x>
                                        <_y>0</_y>
                                        <_width>150</_width>
                                        <_height>75</_height>
                                </text>       
                        </pulsat>
                </boto0>
                <boto1>
                        <repos>
                                <general>
                                        <setRGB>0xFF0000</setRGB>
                                        <_x>0</_x>
                                        <_y>0</_y>
                                        <_width>150</_width>
                                        <_height>75</_height>
                                       
                                </general>
                                <text>
                                        <text>Nadal</text>
                                        <font>verdana</font>
                                        <fontColor>0xFFFFFF</fontColor>
                                        <italic>1</italic>
                                        <bold>1</bold>
                                        <underline>0</underline>
                                        <align>center</align>
                                        <size>22</size>
                                        <_x>0</_x>
                                        <_y>0</_y>
                                        <_width>150</_width>
                                        <_height>75</_height>
                                </text>       
                        </repos>
                        <sobre>
                                <general>
                                        <setRGB>0xFFFF00</setRGB>
                                        <_x>0</_x>
                                        <_y>0</_y>
                                        <_width>150</_width>
                                        <_height>75</_height>
                                       
                                </general>
                                <text>
                                        <text>Nadal</text>
                                        <font>verdana</font>
                                        <fontColor>0x000000</fontColor>
                                        <italic>1</italic>
                                        <bold>1</bold>
                                        <underline>0</underline>
                                        <align>center</align>
                                        <size>22</size>
                                        <_x>0</_x>
                                        <_y>0</_y>
                                        <_width>150</_width>
                                        <_height>75</_height>
                                </text>       
                        </sobre>
                        <presionat>
                                <general>
                                        <setRGB>0xFFFFFF</setRGB>
                                        <_x>0</_x>
                                        <_y>0</_y>
                                        <_width>150</_width>
                                        <_height>75</_height>
                                       
                                </general>
                                <text>
                                        <text>Nadal</text>
                                        <font>verdana</font>
                                        <fontColor>0xFF0000</fontColor>
                                        <italic>1</italic>
                                        <bold>1</bold>
                                        <underline>0</underline>
                                        <align>center</align>
                                        <size>22</size>
                                        <_x>0</_x>
                                        <_y>0</_y>
                                        <_width>150</_width>
                                        <_height>75</_height>
                                </text>       
                        </presionat>
                </boto1>
        </botones>
</datos>

y tengo el siguiente código flash:
Código:

mixml = new XML();
mixml.load("prova.xml");
mixml.ignoreWhite = true;
mixml.onLoad = carregar;
function carregar()
{
        mixml = this.firstChild.firstChild;
        nodoBoton=mixml.childNodes[0];
        trace(nodoBoton);
}

al hacer el trace me saca el nodo del <boto0>,
pero jo quiero que en canviar el trozo de código que pone:
Código:

nodoBoton=mixml.childNodes[0];
por:
Código:

nodoBoton=mixml.childNodes["boto0"];
o algo similar, ya que con esta orden no me funciona.
muchas gracias


La zona horaria es GMT -6. Ahora son las 21:34.

Desarrollado por vBulletin® Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.