actionscript 3 - Actionscript3 parsing json with an object -
i have flash app in function have parse json passed object external api can't change.
my json this:
{ "prodotti": [ { "titolo": "test", "marca": "", "modello": "", "cilindrata": "", "potenza": "", "alimentazione": "", "images": { "img": [ { "thumb": "admin/uploads/img_usato/small/qekabw95l5wh1alf6.jpg", "big": "admin/uploads/img_usato/big/qekabw95l5wh1alf6.jpg" }, { "thumb": "admin/uploads/img_usato/small/default.jpg", "big": "admin/uploads/img_usato/big/default.jpg" } ] } }, { "titolo": "motore volvo tamd 74 c", "marca": "volvo penta", "modello": "tamd 74 c", "cilindrata": "7.283 cm3", "potenza": "331 kw 2600 rpm", "alimentazione": "gasolio", "images": { "img": [ { "thumb": "admin/uploads/img_usato/small/pmqwn4t4yp7p1ycwa.jpg", "big": "admin/uploads/img_usato/big/pmqwn4t4yp7p1ycwa.jpg" }, { "thumb": "admin/uploads/img_usato/small/bwkjtgcy3pdm2lkrs.jpg", "big": "admin/uploads/img_usato/big/bwkjtgcy3pdm2lkrs.jpg" } ] } } ] }
i want parse images inside object. api send me object not astring or json , have function now:
function changedata (prodotto:object) { img_container.graphics.clear (); //here want enter , take thumb , big of images!!! (var index in prodotto.images.img) { //trace('index: ' + index); //trace("thumb: " + index.thumb + ' big: ' + index.big); } descrizione.htmltext = prodotto.testo_html; titolo.text = prodotto.titolo; alimentazione.text = prodotto.alimentazione; potenza.text = prodotto.potenza; cilindrata.text = prodotto.cilindrata; modello.text = prodotto.modello; marca.text = prodotto.marca; }
the function works fine not for loop try take bug , thumb of json how can retrieve information in object?
thanks
i think there wrong how setting call since didn't show code api can't fix that, plus stated have no control on it. no matter issue not seem correct.
i put function thumbs , bigs. did not state otherwise.
function changedata (prodotto:object) { each(var item in prodotto.prodotti){ trace('') //trace(prodotto.testo_html); trace(item.titolo); trace(item.alimentazione); trace(item.potenza); trace(item.cilindrata); trace(item.modello); trace(item.marca); each( var imgs in item.images.img) { trace('thumb',imgs.thumb) trace('big',imgs.big) } } }
Comments
Post a Comment