# Actionscript 2.0 (CS4) - XML/FLASH

**URL:** <https://forum.kirupa.com/t/actionscript-2-0-cs4-xml-flash/309639>\
**Category:** flash\
**Created:** [May 20, 2010, 12:51pm UTC](https://forum.kirupa.com/t/actionscript-2-0-cs4-xml-flash/309639 "2010-05-20T12:51:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nas007](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@nas007](https://forum.kirupa.com/u/nas007)\
**Post date:** [May 20, 2010, 12:51pm UTC](https://forum.kirupa.com/t/actionscript-2-0-cs4-xml-flash/309639/1 "2010-05-20T12:51:41Z")

</div>

Hi,

I have an xml based “slideshow” file that I am trying to edit. I want to add two attributes to the xml/flash doc. Right now the XML file allows me to enter a URL (so when you click an image it will load the specified URL). It does not open in a new window though - I would like to add this option (to be able to edit in the XML file).

Second, there is a global variable set to allow me to control the speed of the slideshow (how long each slide will stay before it moves on to the next one). I would like to change this, so that each slide can be set for it’s own length.

I have attached the .fla file (CS4) for those that can help and will also copy & paste the relevant code below. (please note I commented out some of the code that I did not need ie, stop, pause and caption functionality)

I have attempted to add new attributes following the same pattern that is currently set in the document, unfortunately I do not understand XML very well beyond the basics, and therefore I was unsuccessful).

Your help would sincerely be appreciated.

Thanks.

* * *

FRAME 1 actions:

var myXML = new XML();  
// set xml  
myXML.load(strFilepath); // variable will populate file name  
myXML.ignoreWhite = true;  
myXML.onLoad = function (success:Boolean){  
if(success){  
// get data  
\_global.numOfImage = this.firstChild.childNodes.length;  
\_global.stage\_width = int(this.firstChild.attributes.stage\_width);  
\_global.stage\_height = int(this.firstChild.attributes.stage\_height);  
\_global.caption\_left = int(this.firstChild.attributes.caption\_left);  
\_global.caption\_top = int(this.firstChild.attributes.caption\_top);  
\_global.image\_left = int(this.firstChild.attributes.image\_left);  
\_global.image\_top = int(this.firstChild.attributes.image\_top);  
\_global.control\_left = int(this.firstChild.attributes.control\_left);  
\_global.control\_top = int(this.firstChild.attributes.control\_top);  
\_global.cols = int(this.firstChild.attributes.cols);  
\_global.space = int(this.firstChild.attributes.space);  
\_global.speed = int(this.firstChild.attributes.speed)_1000;  
for (var i = 0; i \< numOfImage; i++){  
var logos = this.firstChild.childNodes_.attributes.logos;  
var httpURL = this.firstChild.childNodes\*.attributes.httpURL;  
var caption = this.firstChild.childNodes\*.childNodes[0].childNodes[0].nodeValue;  
images\* = new Array(thumbnail,logos,httpURL,caption);//big  
}  
play();  
}  
}  
stop ();

/\* END ACTIONS FRAME 1 \*/

* * *

FRAME 3 ACTIONS (relevant to speed and httpURL variables/attributes)

function fadeInBigImage(){  
// fade out the old image  
if (bottomcontainer.\_alpha \> 0){  
bottomcontainer.\_alpha -= 10;  
}  
if (this.\_alpha \< 100){  
this.\_alpha += 10;  
}else{  
delete this.onEnterFrame;  
topcontainer.enabled = false;  
topcontainer.useHandCursor = false;  
if(images[link-1][2]!=""){  
topcontainer.enabled = true;  
topcontainer.useHandCursor = true;  
topcontainer.onRelease = function (){  
getURL(images[link-1][2]);  
}  
}  
// unlock image button  
ani = 0;  
// save current image number  
preLink = link;  
// get next image  
beginInterval();  
}  
}  
function beginInterval(){  
intervalID = setInterval(getNext, speed);  
}  
function getNext(){  
if(autoplay ==1){  
play();  
}  
else{  
clearInterval(intervalID);  
}  
}
