salut,
je charge des données à partir d'un fichier xml.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 <menu> <general> <backgroundcolor>0x000000</backgroundcolor> <linecolor>0xFFFFFF</linecolor> <width>100</width> <height>50</height> </general> ... </menu>le trace me renvoie "object". Et comme je sers de cette valeur dans une opération, cette dernière me renvoie NaN au lieu du résultat attendu !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 var __width:Number; function loadXml(){ var x:XML = new XML(); x.ignoreWhite = true; x.onLoad = function(){ __bgColor = this.firstChild.childNodes[0].childNodes[0].firstChild; __lineColor = this.firstChild.childNodes[0].childNodes[1].firstChild; __width = this.firstChild.childNodes[0].childNodes[2].firstChild; __height = this.firstChild.childNodes[0].childNodes[3].firstChild; trace(typeof(__width)); drawSq(); } x.load('dynamic_menu.xml'); }
Comment faire pour que cette variable soit typée comme un nombre?
Partager