get nested xml tags in Flash, loop within loop

northstjarna

Beginner

Posts: 58

Loc: Chertsey, UK

3+ Months Ago

Hi there,,

I am trying to get this data into flash. I can get the results for each memeber but, when I put in my nested loop to get the information I get the entire array of all the members or just the end results. Here's a bit of the xml file schema first...

If thumbnail_txt is not a variable for the dynamic text, then you should use:thumbnail_txt.text = _global.team_member_name[L];If it is a variable, then you might want to embed the font. Stage -> select the text from the movieclip-> goto properties panel -> Character button -> check Specify Ranges and select Basic Latin.Anyway, consider this code:

thanks for your help. This code didn't help me much, as it created the movie clips but did not spread them out evenly accross the stage 550 X 420. I had to take the attach movie clips out of the nested loop. I also amended so that it would give a new instance name otherwise it did not work.

I have amended it. It almost works. Each Icon or thumbnail should return information about that person, and a seperate array for the countries they have been to.

the function is also returning the last know result in the array, and soes not work if you put it as trace(crtMC.sName[iNodeIndex0]);

it's why I must try to set the ID of each, I am almost there. The clips are laid out and the names of each person assigned to the dynamic text. But its the function when I click on them that's causing the trouble.

And i'm not sure what exactly you trying to do there.
Probably you didn't understand exactly what i did up there. Let me explain it to you.
I create a movieclip for each member, set it's properties (ID, name, location ....), then attach in every member movieclip one single thumbnail_container, since i presume you use only one thumbnail for each member. All you had to do was to dynamically arrange the movieclips on the stage, not to get the thumbnails out of the member movieclips.
If i'm wrong please let me know.

northstjarna

Beginner

Posts: 58

Loc: Chertsey, UK

3+ Months Ago

Sorry.... I am not so good with the new style, lots to learn.

Ok I'll describe what we are trying to achieve here.
I am building a portfolio for a charity organisation.

There is a portfolio which I am building which will load into the main load box on the site. It will be stored as a seperate swf on the server and called into the loadbox when clicked on the portfolio icon. (or the page will end up massive..

So I have and XML file for this swf (see the schema above)
For Each member there is a number of countries which they have done work in.

so from the first set of childnodes in the menuArray we get the basic info about the person, and loads in an icon for each one. When you click in the icon I want to load in the list of each country that person has done work in.

So you get this:

Member A : Tanzania
: Uganda
: Kenya

Menmber B : Ghana
: Uganda

The problem I had was returning all the Countries into a list. component ... addItem in the childnodes of the country

I can get all the countries as a single item in an Array, but not as a list
IE I got

TanzaniaAfricaKenya

instead of

Tanzania
Africa
Kenya

hope this explains better.
Thanks

Andi

IceCold

Guru

Posts: 1253

Loc: Ro

3+ Months Ago

that's because you pass the array to the list, not each member of the array separated by a "\n" (end of line).
What you need is (i work here on my example, provided upper):

// attach thumbnail_container for each member
crtMC.attachMovie("thumbnail_container", "thumbnail_container", 0, {_x:pushoverX ,_y:pushoverY});
crtMC.thumbnail_container.thumbnail_txt = crtMC.sName; /// changed the text to reflect the members name