Comunidad de diseño web y desarrollo en internet online

CARGAR TREE DE DATOS XML

Citar            
MensajeEscrito el 14 Mar 2009 07:19 am
hola por favor si alguien me puede echar la mano
necesito cargar un tree con datos de una base de datos
pero como puedo hacer para que cargue mi tree

ah!!! tengo un libro de flex 3 que me tarde 2 semanas escaneandolo y pasandolo a pdf
y estoy dispuesto a compartirlo

Por perro17up

2 de clabLevel



 

msie7
Citar            
MensajeEscrito el 14 Mar 2009 04:00 pm

Código :

?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
    layout="horizontal" horizontalAlign="left"
     backgroundGradientColors="[0x000000,0x323232]"    
    applicationComplete="srv.send()" viewSourceURL="srcview/index.html">

    <mx:NumberFormatter id="nf"/>
    
    <!-- resultFormat tells the HTTPService how to deserialize the result of the HTTP request.
         By default, the response is deserialized into an object graph. This allows you to navigate through 
         the service result using the dot notation. 
         You can also get the result as an XML document by specifying resultFormat="e4x" on the HTTPService. 
         In that case, you can parse the document using E4X (ECMAScript for XML). -->
    <mx:HTTPService id="srv" url="items.xml" resultFormat="e4x"/>

    <mx:Tree id="tree" dataProvider="{srv.lastResult}" labelField="@name" 
        width="300" height="100%"/>

    <mx:Form>
        <mx:FormItem label="Population:">
            <!-- e4x data binding expression -->
            <mx:TextInput text="{nf.format(tree.selectedItem.@population)}"/>
        </mx:FormItem>
        <mx:FormItem label="Capital:">
            <!-- e4x data binding expression -->
            <mx:TextInput text="{tree.selectedItem.@capital}"/>
        </mx:FormItem>
    </mx:Form>

    <mx:Style>
        FormItem {
            labelStyleName: formItemLabel;
        }
        .formItemLabel {
            color: #FFFFFF;
        }
    </mx:Style>
    
</mx:Application>



xml

Código :

<?xml version="1.0" encoding="utf-8"?>
<item name="Regions">

    <item name="Asia">
       <item name="China" capital="Beijing" population="1321851888"/>
       <item name="Japan" capital="Tokyo" population="127433494"/>
    </item>

    <item name="Europe">
       <item name="Belgium" capital="Brussels" population="10584534"/>
       <item name="England" capital="London" population="50762900"/>
       <item name="France" capital="Paris" population="64473140"/>
       <item name="Germany" capital="Berlin" population="82217800"/>
       <item name="Italy" capital="Rome" population="59619290"/>
       <item name="Spain" capital="Madrid" population="45200737"/>
    </item>

    <item name="North America">
       <item name="Canada" capital="Ottawa" population="33387000"/>
       <item name="USA" capital="Washington DC" population="305284000"/>
    </item>

    <item name="South America">
       <item name="Argentina" capital="Buenos Aires" population="40677348"/>
       <item name="Brazil" capital="Brasília" population="187393918"/>
    </item>

</item>





esa en forma casi manual , pero es un simple ejemplo deberas hacer lo mismo utilzando el remoting o llamando
al un fr de persistencia de base de datos ,luego mapeas desde la base hacia la aplicacion..

..suerte....revisa el tu libro..suerte

Por xcom

Claber

530 de clabLevel



 

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.