• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

tilelist and xml

Explorer ,
May 07, 2012 May 07, 2012

Copy link to clipboard

Copied

I am unable to load pics from xml to TileList

I tried to add through Array & addItem , but both are not working

below is code , when xml is loaded

function clipsXmlLoaded(event:Event):void

{

    clipsXml = XML(clipxmlLoader.data);

    trace(clipsXml);

    for(var c:int = 0; c<clipsXml.length ; c++ )

    {

        //clipsArray.push ({label:"" , source:String(clipsXml.clip)});

        clips_list.addItem({source:String(clipsXml.clip)});

            trace(clipsXml);

    }

    trace("clips");

    //clips_list.dataProvider = new DataProvider(clipsArray);

}

TOPICS
ActionScript

Views

737

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , May 08, 2012 May 08, 2012

clipsXml.length() gives only 1. Thats your loop is not executed. First retrieve your nodes length in xml file then you get the output.

Votes

Translate

Translate
LEGEND ,
May 07, 2012 May 07, 2012

Copy link to clipboard

Copied

The Array class is not the same as the XML class.  You might need to revise your code to agree with the methods of the XML class.  You seem to be using them as properties.   Try...

function clipsXmlLoaded(event:Event):void
{
    clipsXml = XML(clipxmlLoader.data);

    for(var c:int = 0; c<clipsXml.length(); c++ )
    {
        clips_list.addItem({source:String(clipsXml.clip.text())});
    }
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 08, 2012 May 08, 2012

Copy link to clipboard

Copied

this Line not works in loop

clips_list.addItem({source:String(clipsXml.clip)});

but when I use outside the loop IT WORKS like this :

clips_list.addItem({source:String(clipsXml.clip[1])});

clips_list.addItem({source:String(clipsXml.clip[2])});

clips_list.addItem({source:String(clipsXml.clip[3])});

loop is not working , but it tracing path also fine

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 08, 2012 May 08, 2012

Copy link to clipboard

Copied

clipsXml.length() gives only 1. Thats your loop is not executed. First retrieve your nodes length in xml file then you get the output.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 08, 2012 May 08, 2012

Copy link to clipboard

Copied

LATEST

somtime Minor error creates so much time wast

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines