well not really… i am trying to populate an MC/text field via XML and the duplicate this underneath itself (in a loop) for how ever many lines of the xml there are… Ive got quite far in my humble opnion but seem to have come unstuck on the looping and duplicating…
My code only duplicates the movieclip once - and the second movieclip is not populated (ie pulling data from the xml) only the first one is!..
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
clname = [];
image = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
clname* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
image* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
}
loadceleb();
//trace(clname[2]);
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("celebs.xml");
function loadceleb() {
for (i=0; i<total; i++) {
duplicateMovieClip("chold", "chold"+*, *);
setProperty ( "chold"+*, _y, "55");
_root.chold.text_hold = clname*;
}
}
most non-silly people attachMovie() within the for loop
also they don’t use root, and increment the instance name
_root.chold.text_hold = clname*; << wrong
*[“chold”+i].textField.text = _root.clname; **
see the way I do it _root is ok lol
thanks - i get half of that - still only loops twice though when there are four entries in the XML?.
I tried your way of setting the text and that just gave me ‘Unexpected ‘.’ encountered’
Also tried attachMovie() out of curiosity to see how that worked out and that didnt loop at all…
‘a little more knowledgeable / a little more confused’
**check total!! trace statements **
(yup you need to specify the full path, starting with [] mucks it up)
here’s an example from a file, your setProperty might be mucking things up
you have enabled AS linkages for the file your duplicating?
home.testing.gah.attachMovie("test", "but"+i, home.testing.gah.getNextHighestDepth());
home.testing.gah["but"+i]._x = 0;
//trace(home.testing.gah["but"+i]._height);
vheight = home.testing.gah["but"+i]._height;
home.testing.gah["but"+i]._y = (vheight+2.6)*i;
home.testing.gah["but"+i].itemBut.dynt.text = "Part "+(i+1);
home.testing.gah["but"+i].itemBut.desc.text = videos*.attributes.desc;
_level0.testing.gah["but"+i].itemBut.clicked._visible = false;
ok we have progress!. (as linkage is on and named, total is traced at 4 and the text field is populated with the first item of my array… woot)…
although its still not looping/duplicating…
function loadceleb() {
for (i=0; i<total; i++) {
attachMovie("chold", "chold"+i,i);
setProperty ( "chold"+i, _y, "5");
_level0["chold"+i].text_hold= _root.clname*;
}
}
attached - this is the part where you say it was something simple and label me a numpty hey?
hides under desk
ponders how to put this…
Key fault 1: READ MY POSTS:m:, you are english right? setProperty doesn’t work in this situation or at least the way you have coded it
Key Fault 2: where you’ve mucked up is you are trying to apply fancy animation to text, hence you have placed it as a graphic instead of an MC and wound up with tweens
the way I can think of is having two textfields the same, one black-one white, and fading each other out
HOWEVER not on the timeline, you will have to use tween class, else you are going to loose your variables everytime you tween something manually.
[SIZE=7]NB[/SIZE]
I don’t see why I should help someone get paid for work they are not doing… I am doing
apologies, i had added setProperty in and out a few times during trial and error testing!.
Note taken on the animation - i had been trying to break everything down to as simple as possible to have the best possible chance of understanding/learning what i was doing.
will see what i can do.
there are examples up and down kirupa
gotoandlearn.com etc
on this issue I just don’t see why you haven’t looked