我想創建一個嵌套數組。這是我的代碼,加載xml後。AS3從xml創建多維數組
function readXML(event:Event):void
{
_data = new XML(event.target.data);
for each (var usr in _data.item)
{
allUserbase.push({name: [email protected],state: [email protected],
complex: usr.complex,image:[email protected], link: [email protected]});
for (var k:int = 0; k< allUserbase.length; k++){
trace(k, allUserbase[k].complex);
for (var t:int = 0; t< allUserbase[k].length; t++){
trace(k,t, allUserbase[k][t]);
// this part when i try to built 2d array doesnt work.. :(*/
}
這裏是我的XML:
<content>
<item image="John.jpg" name="John" state = "New Jersey" >
<complex fid = "0"> mg749</complex>
<complex fid = "1"> ks749</complex>
<complex fid = "2"> ks678</complex>
</item>
<item image="Smith.jpg" name="Smith" state = "California">
<complex fid = "0"> we649</complex>
<complex fid = "1"> sd449</complex>
<complex fid = "2"> df459</complex>
<complex fid = "3"> hj569</complex>
</item>
<item image="Smith.jpg" name="Mike" state = "New York">
<complex fid = "0"> 8794</complex>
<complex fid = "1"> 4384</complex>
</item>
</content>;
這是您第三次在3天內詢問同一個問題嗎?並沒有接受任何舊的答案? – Mike 2011-02-25 20:51:07
哦,是的,我知道我以前見過這個問題。 – Taurayi 2011-02-25 20:55:44
@Mike和@Taurayi -yes,我沒有得到我的答案,並絕望,但非常感謝幫助.. – hanna 2011-02-28 14:57:07