Hi!
This is the deal, I’m pretty new to XML with Flash and I’m trying to do this moviegallery thing, right? So far, I’ve gotten it to display the thumbnails by looking at an XML file, and I must say I’m quite proud of myself and it works pretty nice.
Now, here’s the code.
//XML initialization
_global.myXML = new XML();
myXML.ignoreWhite = true;
//XML ACTION!!!
myXML.onLoad = function(success) {
if (success) {
//initialization//
this.root = this.firstChild;
_root.tekst.text = this.root;
cnt_rows = 0;
cnt_items = 0;
num_images = myXML.root.childNodes.length;
//action!//
for(i=0;i<num_images;i++) {
_root.myclip = _root.createEmptyMovieClip("picture"+i,i);
_root.myclip.loadMovie(myXML.root.childNodes*.attributes.tmb,1);
if (((i%3) == 0) && (i != 0)) {
cnt_rows++;
cnt_items = 0;
}
_root.myclip._x = 1 + 67*cnt_items;
_root.myclip._y = 1 + 67*cnt_rows;
cnt_items++;
}
} else {
trace("ERROR GETTING XML FILE");
}
}
//load the XML
myXML.load("xml2/table.xml");
It dynamically creates movie clips, and puts the thumbnail images in them, all while sorting them in a nice manner. So far everything works fine, but if I try to add a function to the movie clips like so:
_root.myclip.onPress = function() {
blah blah blah
}
It just doesn’t work. It’s like I didn’t even create the function. And it’s not just onPress, any type of event - onLoad, onRollOver etc, it just won’t budge. So does anyone know why I can’t add functions to the dynamically created movieclips?
I can put up the fla, xml and the images in a zip if anyone thinks it’ll help.
Thanks in advance, all help is appreciated.