I need help ! (newbie in AS2)
I want to have two XML
One button (that onRealese it goes to second frame or previous)
2 frames
1st frame AS
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function() {
//parse XML data:
var imagesNode = myXML.firstChild;
var totalImages = myXML.firstChild.childNodes.length;
for (i=0; i<totalImages; i++) {
var imgNode = imagesNode.childNodes*.childNodes[0].firstChild.nodeValue;
var textNode = imagesNode.childNodes*.childNodes[1].firstChild.nodeValue;
var linkNode = imagesNode.childNodes*.childNodes[0].attributes.link;
trace("test: "+imgNode);
trace("test: "+textNode);
trace("link: "+linkNode);
//attatch template clips to hold images & text
var newClip = _root.attachMovie("templateClip", "templateClip"+i, _root.getNextHighestDepth());
//Define the grid columns (in number of cells);
var columns:Number = 4;
//Define the item hSpacing;
var hSpacing:Number = 10;
//Define the item hSpacing;
var vSpacing:Number = 10;
//position clip
newClip._x = 50;
newClip._y = 10;
newClip._x += ((i%columns))*(newClip._width+hSpacing);
newClip._y += Math.floor(i/columns)*(newClip._height+vSpacing);
//populate template clip
newClip.textField_txt.text = textNode;
newClip.imageHolder.loadMovie(imgNode);
newClip.btn.onPress = function() {
getURL(linkNode, "_blank");
};
}
};
myXML.load("data.xml");
stop();
2nd frame
var myXML2:XML = new XML();
myXML2.ignoreWhite = true;
myXML2.onLoad = function() {
//parse XML data:
var imagesNode = myXML2.firstChild;
var totalImages = myXML2.firstChild.childNodes.length;
for (i=0; i<totalImages; i++) {
var imgNode = imagesNode.childNodes*.childNodes[0].firstChild.nodeValue;
var textNode = imagesNode.childNodes*.childNodes[1].firstChild.nodeValue;
var linkNode = imagesNode.childNodes*.childNodes[0].attributes.link;
trace("test: "+imgNode);
trace("test: "+textNode);
trace("link: "+linkNode);
//attatch template clips to hold images & text
var newClip = _root.attachMovie("templateClip", "templateClip"+i, _root.getNextHighestDepth());
//Define the grid columns (in number of cells);
var columns:Number = 4;
//Define the item hSpacing;
var hSpacing:Number = 10;
//Define the item hSpacing;
var vSpacing:Number = 10;
//position clip
newClip._x = 50;
newClip._y = 10;
newClip._x += ((i%columns))*(newClip._width+hSpacing);
newClip._y += Math.floor(i/columns)*(newClip._height+vSpacing);
//populate template clip
newClip.textField_txt.text = textNode;
newClip.imageHolder.loadMovie(imgNode);
newClip.btn.onPress = function() {
getURL(linkNode, "_blank");
};
}
};
myXML2.load("data2.xml");
stop();
Button AS2 on frame 1
on (release) {
nextFrame();
}
Button AS2 on frame 2
on (release) {
prevFrame();
}
My issue is it’s not removing the first loaded XML
I really don’t understand how to do this…
Thx! for helping me in advance !!