# Problem with getting xml into button url Array and xml text on seperate buttons

**URL:** https://forum.kirupa.com/t/problem-with-getting-xml-into-button-url-array-and-xml-text-on-seperate-buttons/241741
**Category:** flash
**Created:** [October 17, 2007, 3:23pm UTC](https://forum.kirupa.com/t/problem-with-getting-xml-into-button-url-array-and-xml-text-on-seperate-buttons/241741 "2007-10-17T15:23:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![BoldLion](https://avatars.discourse-cdn.com/v4/letter/b/b19c9b/32.png) [@BoldLion](https://forum.kirupa.com/u/BoldLion)
#### Post date: [October 17, 2007, 3:23pm UTC](https://forum.kirupa.com/t/problem-with-getting-xml-into-button-url-array-and-xml-text-on-seperate-buttons/241741/1 "2007-10-17T15:23:54Z")

</div>

I can get most of this xml file to load and loop through array but having a little trouble getting the read more and buy tickets buttons url. The way this app is suppose to work is when they click on a different button which has different instances but contains the same dynamic text fields. The same xml information loads in every button. I have no idea of how to set up the buttons for read more and buty tickets url to an outside website and have it dynamically linked to the xml file. Can someone please help me

Here is the actionscript i used

stop();  
// import Fuse  
import com.mosesSupposes.fuse.\*;  
// set up zigoEngine to use just simple shortcut animation  
ZigoEngine.simpleSetup(Shortcuts, PennerEasing, FuseFMP);  
var x:XML = new XML();  
x.ignoreWhite = true; //ignore tabs and other white space

var urls:Array = new Array(); //stores urls for photos  
var headers:Array = new Array(); // stores all the titles read in from xml  
var subheaders:Array = new Array(); // stores all the subtitles read in from xml  
var dates:Array = new Array(); // stores all the dates read in from xml  
var occasions:Array = new Array(); // stores all the events read in from xml  
var stages:Array = new Array(); // stores all the stage read in from xml  
var whoIsOn:Number; //keeps track of which photo is on

x.onLoad = function() {  
var photo:Array = this.firstChild.childNodes;  
for(i=0;i\<photo.length;i++) {  
urls.push(photo\*.attributes.url );  
headers.push(photo\*.attributes.header);  
subheaders.push(photo\*.attributes.subheader);  
dates.push(photo\*.attributes.date);  
occasions.push(photo\*.attributes.occasion);  
stages.push(photo\*.attributes.stage);  
}  
holder.loadMovie(urls[0]);  
header.text = headers[0];  
subheader.text = subheaders[0];  
date.text = dates[0];  
occasion.text = occasions[0];  
stage.text = stages[0];  
whoIsOn = 0;  
}

x.load(“slideshow.xml”);

previous.onRelease = function() {  
if (whoIsOn\>0) {

whoIsOn–;  
holder.loadMovie(urls[whoIsOn]);  
header.text = headers[whoIsOn];  
subheader.text = subheaders[whoIsOn];  
date.text = dates[whoIsOn];  
occasion.text = occasions[whoIsOn];  
stage.text = stages[whoIsOn];  
}  
prevFrame();  
};

next.onRelease = function() {  
if (whoIsOn\<urls.length-1) {  
whoIsOn++;  
holder.loadMovie (urls[whoIsOn]);  
header.text = headers[whoIsOn];  
subheader.text = subheaders[whoIsOn];  
date.text = dates[whoIsOn];  
occasion.text = occasions[whoIsOn];  
stage.text = stages[whoIsOn];  
}

nextFrame();  
};  
// declare the variable that will be the button that is clicked (MovieClip)  
var buttonClicked:MovieClip;

// create the array to hold all the names of the movieClips  
var myButtonsArray:Array = new Array(this[“myButton0”], this[“myButton1”], this[“myButton2”], this[“myButton3”], this[“myButton4”], this[“myButton5”], this[“myButton6”], this[“myButton7”], this[“myButton8”]);  
myButton1.onLoad = function(){  
var photo:Array = this.firstChild.childNodes;  
for(i=0;i\<photo.length;i++) {  
dates.push(photo\*.attributes.date);  
occasions.push(photo\*.attributes.occasion);  
stages.push(photo\*.attributes.stage);  
}  
date.text = dates[1];  
occasion.text = occasions[1];  
stage.text = stages[1];  
whoIsOn = 1;  
}  
myButton0.onLoad = function(){  
scaleButtonsUp(this);  
}

myButton0.onRelease = function() {  
gotoAndStop(“event1”);  
whoIsOn[0];  
holder.loadMovie(urls[0]);  
header.text = headers[0];  
subheader.text = subheaders[0];  
date.text = dates[0];  
occasion.text = occasions[0];  
stage.text = stages[0];  
whoIsOn = 0;

// create the variable that we pass into the scaleButtonDown func  
var exception = this;  
// run the scale buttons down function  
scaleButtonsDown(exception);  
// set the buttonClicked to this  
buttonClicked = this;  
};

myButton0.onRollOver = function():Void {  
// run scale buttons up func and pass in this  
scaleButtonsUp(this);  
};  
myButton0.onRollOut = function():Void {  
// run scale buttons down function  
scaleButtonsDown();  
};

// scale buttons up function  
scaleButtonsUp = function (args):Void {  
// scale the args (remember the button passed in this) to 100 over 1 seconds  
args.scaler.\_alpha=“100”;  
};

// scale buttons down func  
scaleButtonsDown = function ():Void {  
// loop through myButtonsArray  
for (var i:Number = 0; i\<myButtonsArray.length; i++) {  
// scale all buttons down over a 1 second period  
myButtonsArray\*.scaler.\_alpha = “0”;  
// make the buttonClicked scale to 100 over zero seconds  
}  
buttonClicked.scaler.\_alpha = “100”;  
};

myButton1.onRelease = function() {  
whoIsOn[1];  
holder.loadMovie(urls[1]);  
header.text = headers[1];  
subheader.text = subheaders[1];  
date.text = dates[1];  
occasion.text = occasions[1];  
stage.text = stages[1];  
whoIsOn = 1;  
//Movieclip GotoAndStop Behavior  
gotoAndStop(“7”);  
//End Behavior

buttonClicked = this;  
var exception = this;  
scaleButtonsDown(exception);  
};  
//  
myButton1.onRollOver = function():Void {  
scaleButtonsUp(this);  
};  
//  
myButton1.onRollOut = function():Void {  
scaleButtonsDown(null);  
};  
//  
myButton2.onRelease = function() {  
whoIsOn[2];  
holder.loadMovie(urls[2]);  
header.text = headers[2];  
subheader.text = subheaders[2];  
date.text = dates[2];  
occasion.text = occasions[2];  
stage.text = stages[2];  
whoIsOn = 2;  
gotoAndStop(event3);  
buttonClicked = this;  
var exception = this;  
scaleButtonsDown(exception);  
};  
//  
myButton2.onRollOver = function():Void {  
scaleButtonsUp(this);  
};  
//  
myButton2.onRollOut = function():Void {  
scaleButtonsDown(null);  
};

//  
myButton3.onRelease = function() {  
whoIsOn[3];  
holder.loadMovie(urls[3]);  
header.text = headers[3];  
subheader.text = subheaders[3];  
date.text = dates[3];  
occasion.text = occasions[3];  
stage.text = stages[3];  
whoIsOn = 3;  
gotoAndStop(event4);  
buttonClicked = this;  
var exception = this;  
scaleButtonsDown(exception);  
};  
//  
myButton3.onRollOver = function():Void {  
scaleButtonsUp(this);  
};  
//  
myButton3.onRollOut = function():Void {  
scaleButtonsDown(null);  
};

//  
myButton4.onRelease = function() {  
whoIsOn[4];  
holder.loadMovie(urls[4]);  
header.text = headers[4];  
subheader.text = subheaders[4];  
date.text = dates[4];  
occasion.text = occasions[4];  
stage.text = stages[4];  
whoIsOn = 4;  
gotoAndStop(event5);  
buttonClicked = this;  
var exception = this;  
scaleButtonsDown(exception);  
};  
//  
myButton4.onRollOver = function():Void {  
scaleButtonsUp(this);  
};  
//  
myButton4.onRollOut = function():Void {  
scaleButtonsDown(null);  
};

//  
myButton5.onRelease = function() {  
whoIsOn[5];  
holder.loadMovie(urls[5]);  
header.text = headers[5];  
subheader.text = subheaders[5];  
date.text = dates[5];  
occasion.text = occasions[5];  
stage.text = stages[5];  
whoIsOn = 5;  
gotoAndStop(event6);  
buttonClicked = this;  
var exception = this;  
scaleButtonsDown(exception);  
};  
//  
myButton5.onRollOver = function():Void {  
scaleButtonsUp(this);  
};  
//  
myButton5.onRollOut = function():Void {  
scaleButtonsDown(null);  
};

//  
myButton6.onRelease = function() {  
whoIsOn[6];  
holder.loadMovie(urls[6]);  
header.text = headers[6];  
subheader.text = subheaders[6];  
date.text = dates[6];  
occasion.text = occasions[6];  
stage.text = stages[6];  
whoIsOn = 6;  
gotoAndStop(event7);  
buttonClicked = this;  
var exception = this;  
scaleButtonsDown(exception);  
};  
//  
myButton6.onRollOver = function():Void {  
scaleButtonsUp(this);  
};  
//  
myButton6.onRollOut = function():Void {  
scaleButtonsDown(null);  
};

//  
myButton7.onRelease = function() {

whoIsOn[7];  
holder.loadMovie(urls[7]);  
header.text = headers[7];  
subheader.text = subheaders[7];  
date.text = dates[7];  
occasion.text = occasions[7];  
stage.text = stages[7];  
whoIsOn = 7;  
buttonClicked = this.gotoAndStop(event8);  
var exception = this;  
scaleButtonsDown(exception);  
};  
//  
myButton7.onRollOver = function():Void {  
scaleButtonsUp(this);  
};  
//  
myButton7.onRollOut = function():Void {  
scaleButtonsDown(null);  
};

//  
myButton8.onRelease = function() {  
whoIsOn[8];  
holder.loadMovie(urls[8]);  
header.text = headers[8];  
subheader.text = subheaders[8];  
date.text = dates[8];  
occasion.text = occasions[8];  
stage.text = stages[8];  
whoIsOn = 8;  
gotoAndStop(event7);  
buttonClicked = this;  
var exception = this;  
scaleButtonsDown(exception);  
};  
//  
myButton8.onRollOver = function():Void {  
scaleButtonsUp(this);  
};  
//  
myButton8.onRollOut = function():Void {  
scaleButtonsDown(null);  
};  
// scale all buttons down at start of movie  
scaleButtonsDown();

AND XML AS FOLLOWS

stop();  
// import Fuse  
import com.mosesSupposes.fuse.\*;  
// set up zigoEngine to use just simple shortcut animation  
ZigoEngine.simpleSetup(Shortcuts, PennerEasing, FuseFMP);  
var x:XML = new XML();  
x.ignoreWhite = true; //ignore tabs and other white space

var urls:Array = new Array(); //stores urls for photos  
var headers:Array = new Array(); // stores all the titles read in from xml  
var subheaders:Array = new Array(); // stores all the subtitles read in from xml  
var dates:Array = new Array(); // stores all the dates read in from xml  
var occasions:Array = new Array(); // stores all the events read in from xml  
var stages:Array = new Array(); // stores all the stage read in from xml  
var whoIsOn:Number; //keeps track of which photo is on

x.onLoad = function() {  
var photo:Array = this.firstChild.childNodes;  
for(i=0;i\<photo.length;i++) {  
urls.push(photo\*.attributes.url );  
headers.push(photo\*.attributes.header);  
subheaders.push(photo\*.attributes.subheader);  
dates.push(photo\*.attributes.date);  
occasions.push(photo\*.attributes.occasion);  
stages.push(photo\*.attributes.stage);  
}  
holder.loadMovie(urls[0]);  
header.text = headers[0];  
subheader.text = subheaders[0];  
date.text = dates[0];  
occasion.text = occasions[0];  
stage.text = stages[0];  
whoIsOn = 0;  
}

x.load(“slideshow.xml”);

previous.onRelease = function() {  
if (whoIsOn\>0) {

whoIsOn–;  
holder.loadMovie(urls[whoIsOn]);  
header.text = headers[whoIsOn];  
subheader.text = subheaders[whoIsOn];  
date.text = dates[whoIsOn];  
occasion.text = occasions[whoIsOn];  
stage.text = stages[whoIsOn];  
}  
prevFrame();  
};

next.onRelease = function() {  
if (whoIsOn\<urls.length-1) {  
whoIsOn++;  
holder.loadMovie (urls[whoIsOn]);  
header.text = headers[whoIsOn];  
subheader.text = subheaders[whoIsOn];  
date.text = dates[whoIsOn];  
occasion.text = occasions[whoIsOn];  
stage.text = stages[whoIsOn];  
}

nextFrame();  
};  
// declare the variable that will be the button that is clicked (MovieClip)  
var buttonClicked:MovieClip;

// create the array to hold all the names of the movieClips  
var myButtonsArray:Array = new Array(this[“myButton0”], this[“myButton1”], this[“myButton2”], this[“myButton3”], this[“myButton4”], this[“myButton5”], this[“myButton6”], this[“myButton7”], this[“myButton8”]);  
myButton1.onLoad = function(){  
var photo:Array = this.firstChild.childNodes;  
for(i=0;i\<photo.length;i++) {  
dates.push(photo\*.attributes.date);  
occasions.push(photo\*.attributes.occasion);  
stages.push(photo\*.attributes.stage);  
}  
date.text = dates[1];  
occasion.text = occasions[1];  
stage.text = stages[1];  
whoIsOn = 1;  
}  
myButton0.onLoad = function(){  
scaleButtonsUp(this);  
}

myButton0.onRelease = function() {  
gotoAndStop(“event1”);  
whoIsOn[0];  
holder.loadMovie(urls[0]);  
header.text = headers[0];  
subheader.text = subheaders[0];  
date.text = dates[0];  
occasion.text = occasions[0];  
stage.text = stages[0];  
whoIsOn = 0;

// create the variable that we pass into the scaleButtonDown func  
var exception = this;  
// run the scale buttons down function  
scaleButtonsDown(exception);  
// set the buttonClicked to this  
buttonClicked = this;  
};

myButton0.onRollOver = function():Void {  
// run scale buttons up func and pass in this  
scaleButtonsUp(this);  
};  
myButton0.onRollOut = function():Void {  
// run scale buttons down function  
scaleButtonsDown();  
};

// scale buttons up function  
scaleButtonsUp = function (args):Void {  
// scale the args (remember the button passed in this) to 100 over 1 seconds  
args.scaler.\_alpha=“100”;  
};

// scale buttons down func  
scaleButtonsDown = function ():Void {  
// loop through myButtonsArray  
for (var i:Number = 0; i\<myButtonsArray.length; i++) {  
// scale all buttons down over a 1 second period  
myButtonsArray\*.scaler.\_alpha = “0”;  
// make the buttonClicked scale to 100 over zero seconds  
}  
buttonClicked.scaler.\_alpha = “100”;  
};

myButton1.onRelease = function() {  
whoIsOn[1];  
holder.loadMovie(urls[1]);  
header.text = headers[1];  
subheader.text = subheaders[1];  
date.text = dates[1];  
occasion.text = occasions[1];  
stage.text = stages[1];  
whoIsOn = 1;  
//Movieclip GotoAndStop Behavior  
gotoAndStop(“7”);  
//End Behavior

buttonClicked = this;  
var exception = this;  
scaleButtonsDown(exception);  
};  
//  
myButton1.onRollOver = function():Void {  
scaleButtonsUp(this);  
};  
//  
myButton1.onRollOut = function():Void {  
scaleButtonsDown(null);  
};  
//  
myButton2.onRelease = function() {  
whoIsOn[2];  
holder.loadMovie(urls[2]);  
header.text = headers[2];  
subheader.text = subheaders[2];  
date.text = dates[2];  
occasion.text = occasions[2];  
stage.text = stages[2];  
whoIsOn = 2;  
gotoAndStop(event3);  
buttonClicked = this;  
var exception = this;  
scaleButtonsDown(exception);  
};  
//  
myButton2.onRollOver = function():Void {  
scaleButtonsUp(this);  
};  
//  
myButton2.onRollOut = function():Void {  
scaleButtonsDown(null);  
};

//  
myButton3.onRelease = function() {  
whoIsOn[3];  
holder.loadMovie(urls[3]);  
header.text = headers[3];  
subheader.text = subheaders[3];  
date.text = dates[3];  
occasion.text = occasions[3];  
stage.text = stages[3];  
whoIsOn = 3;  
gotoAndStop(event4);  
buttonClicked = this;  
var exception = this;  
scaleButtonsDown(exception);  
};  
//  
myButton3.onRollOver = function():Void {  
scaleButtonsUp(this);  
};  
//  
myButton3.onRollOut = function():Void {  
scaleButtonsDown(null);  
};

//  
myButton4.onRelease = function() {  
whoIsOn[4];  
holder.loadMovie(urls[4]);  
header.text = headers[4];  
subheader.text = subheaders[4];  
date.text = dates[4];  
occasion.text = occasions[4];  
stage.text = stages[4];  
whoIsOn = 4;  
gotoAndStop(event5);  
buttonClicked = this;  
var exception = this;  
scaleButtonsDown(exception);  
};  
//  
myButton4.onRollOver = function():Void {  
scaleButtonsUp(this);  
};  
//  
myButton4.onRollOut = function():Void {  
scaleButtonsDown(null);  
};

//  
myButton5.onRelease = function() {  
whoIsOn[5];  
holder.loadMovie(urls[5]);  
header.text = headers[5];  
subheader.text = subheaders[5];  
date.text = dates[5];  
occasion.text = occasions[5];  
stage.text = stages[5];  
whoIsOn = 5;  
gotoAndStop(event6);  
buttonClicked = this;  
var exception = this;  
scaleButtonsDown(exception);  
};  
//  
myButton5.onRollOver = function():Void {  
scaleButtonsUp(this);  
};  
//  
myButton5.onRollOut = function():Void {  
scaleButtonsDown(null);  
};

//  
myButton6.onRelease = function() {  
whoIsOn[6];  
holder.loadMovie(urls[6]);  
header.text = headers[6];  
subheader.text = subheaders[6];  
date.text = dates[6];  
occasion.text = occasions[6];  
stage.text = stages[6];  
whoIsOn = 6;  
gotoAndStop(event7);  
buttonClicked = this;  
var exception = this;  
scaleButtonsDown(exception);  
};  
//  
myButton6.onRollOver = function():Void {  
scaleButtonsUp(this);  
};  
//  
myButton6.onRollOut = function():Void {  
scaleButtonsDown(null);  
};

//  
myButton7.onRelease = function() {

whoIsOn[7];  
holder.loadMovie(urls[7]);  
header.text = headers[7];  
subheader.text = subheaders[7];  
date.text = dates[7];  
occasion.text = occasions[7];  
stage.text = stages[7];  
whoIsOn = 7;  
buttonClicked = this.gotoAndStop(event8);  
var exception = this;  
scaleButtonsDown(exception);  
};  
//  
myButton7.onRollOver = function():Void {  
scaleButtonsUp(this);  
};  
//  
myButton7.onRollOut = function():Void {  
scaleButtonsDown(null);  
};

//  
myButton8.onRelease = function() {  
whoIsOn[8];  
holder.loadMovie(urls[8]);  
header.text = headers[8];  
subheader.text = subheaders[8];  
date.text = dates[8];  
occasion.text = occasions[8];  
stage.text = stages[8];  
whoIsOn = 8;  
gotoAndStop(event7);  
buttonClicked = this;  
var exception = this;  
scaleButtonsDown(exception);  
};  
//  
myButton8.onRollOver = function():Void {  
scaleButtonsUp(this);  
};  
//  
myButton8.onRollOut = function():Void {  
scaleButtonsDown(null);  
};  
// scale all buttons down at start of movie  
scaleButtonsDown();
