Autrement dit, comment pourrai-je boucler sur mon fichier XML dans Flex 3 pour pouvoir récupérer tous les éléments de mon fichier XML
Voici mon code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| <?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="rest_service.send()" >
<mx:HTTPService id="rest_service" url="http://serveur/espace_stagiaires/2007/othmane_abisourour/Flex/flex1/rest.php"/>
<mx:TileList id="tlist0" left="94" top="55"
height="278" width="351"
fontSize="10" fontStyle="bold"
columnCount="4" rowCount="4"
direction="horizontal"
dataProvider="{rest_service.lastResult.people.person}"
allowMultipleSelection="true"
/>
</mx:Application> |
La TitleList m'affiche [object object] au lieu de me récupérer la bonne valeur. alors quand je met:
dataProvider="{rest_service.lastResult.people.person[1].id}"
Il m'affiche qu'un seule élément, et c'est normal, puisque je lui précise 1, alors je ne sais pas comment pourrais-je boucler pour avoir et afficher tout mes données donc la TitleList
voici le code de mon fichier php, si ça pourrez vous aider:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| <?php
$MySQLConnection = mysql_connect( "localhost", "root", "" );
//connecting and picking DB
mysql_select_db("flex1");
//making the query from table contactos
$Query = "SELECT id from contacts";
$Result = mysql_query( $Query );
/* fetching data and output as xml */
$xml="<people>\n";
while( $Row = mysql_fetch_object( $Result ) )
{ $xml.="<person><id>".$Row->id."</id></person>\n";
}
$xml.="</people>";
echo $xml;
?> |
merci
Partager