Hello all I am trying to achieve a article setup through xml. I know how to write a loop that loops through the xml file and grabs all the nodes but would I would like to do is loop through the xml file and only retrive lets say the first 4 instead of the entire xml file.
After that I would like to then create a next button that will retrieve the next 4 xml nodes and display them inside the attachedMovie clip “buttons_mc” to the stage And have a previous button that will will do the same thing the only difference would be to retrieve the previous 4 entries
I have attached my .fla inside a zip to give a better idea of what I am trying to achieve.
I hope this makes sense and help would be greatly appreaciated :).
edit: if you look at my .fla file I have and dynamically attached movieclip called “button_mc” I am trying to display four records at a time inside this dynamic attached movieclip. I hope this helps
xml file
<?xml version="1.0" encoding="ISO-88559-1"?>
<news>
<item article="Hello Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam"
caption="Lorem ipsum dolor sit ametLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,"
image="images/pic1.jpg" />
<item article=" Good Bye Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam Hello"
caption="Lorem ipsum dolor sit ametLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et" image="images/pic2.jpg" />
<item article="See You Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam"
caption="Lorem ipsum dolor sit ametLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et" image="images/pic3.jpg" />
<item article="Ohla Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna"
caption="Lorem ipsum dolor sit ameT"image="images/pic4.jpg" />
</news>
action script
var x:XML = new XML();
x.ignoreWhite = true;
//set up array variables from xml nodes//
var articles:Array = new Array();
var captions:Array = new Array();
var images:Array = new Array();
var current:Number;
//set up onload event for xml//
x.onLoad = function() {
var items:Array = this.firstChild.childNodes;
for (i=0; i<items.length; i++) {
var currentButton = items*;
articles.push(items*.attributes.article);
captions.push(items*.attributes.caption);
images.push(items*.attributes.image);
//dynamically attach each 0buttons to the stage and load corresponding dynamic data//
v_spacing = 70;
var b1 = attachMovie("button_mc","button_mc"+i,i);
b1._y = i*v_spacing;
b1._x = 448;
b1.captions = currentButton.attributes.caption;
b1.images = currentButton.attributes.image;
b1.news_btn.text = articles*;
b1.onRelease = function(){
loader.loadMovie(this.images);
news_txt.text = this.captions;
}
//need help writing the next_btn function//
next_btn.onRelease = function () {
}
//need help writing the previous_btn function//
}
//load first image+first description//
loader.loadMovie(images[0]);
news_txt.text = captions[0];
b2.news_btn.text = articles[0];
current = 0;
};
//load path to xml file//
x.load("news.xml");