I am writing a program to load in an xml file from the server and create an animation to represent this data (for use as a 'front end' for the data).
I have loaded in the XML data into the script no worries. I have also managed to duplicate 1 set of movieclips relating to this data. In this case there are 10 childnodes in the xml therefore 10 clips appear on stage.
Each of the childnodes has a different number of their own childnodes. I have populated an array using for loops (can also use while loops) with the amount of children of each childnode. I have also managed to populate an array of all the names of these further children.
That works fine, heres the problem....
I have a piece of code that when the button is clicked it will search the XML file for the correct childnode and then search this node further to return all children into an array. The code will create a duplicate of a movieclip for each of the children....... or at least it should!!!
I know the code is working correctly as the array is being populated and the trace i inserted is returning the correct amount of times. However when i debug i realise that instead of duplicating the clip say 10 times, it duplicates it once and moves it 9 spaces to the right, reusing the same instance each time.....
I am so sorry if i have confused anyone...This is realy causing me a problem....Mayb e i am overlooking something simple?
Heres the function in question:
Expand|Select|Wrap|Line Numbers
- _global.courseDuplication = function() {
- for (var a=0;a<_global.categoryCount;a++){
- if(_global.currentName == vleXML.firstChild.childNodes[a].attributes.id) {
- for(var b=0; b < vleXML.firstChild.childNodes[a].childNodes.length; b++) {
- _root.courses_mc.duplicateMovieClip(vleXML.firstChild.childNodes[a].childNodes[b].attributes.id, this.getNextHighestDepth(), {_x:a*12});
- trace("duplicated!");
- }
- a = _global.categoryCount;
- _global.duplicationFunction = 0;
- }
- }
- }
I would greatly appreciate any ideas....
Cheers
Gav