I would like to create a xml based slideshow where only two movieclips exist, an array of the total number of pictures is obtained from an xml file, and each picture alpha fades to the next. I have seen this done a few times and looked over the code so I know the general idea but need help, so I will describe in in pseudocode. I have made it here(
http://www.jerble.com/Other/home.swf) in flash, but would now like to integrate xml and do it in actionscript.
Code:
rootNode = new XML();
rootNode.ignoreWhite = true;
rootNode.load("pictures.xml");
rootNode.onLoad = function(success) {
if (success) {
var ef = rootNode.firstChild.childNodes;
_global.ef=ef;
}
}
//PSEUDOCODE BEGINS
variable one=new movieclip;
variable two=new movieclip;
for(i=0;i<ef.length();i++)
{
one=box.load()=ef[i].firstChild.nodeValue; (where the value is the url of the image)
for(j=0;j<100();j++)
{
if (j==50) then: two=text=ef[i+1].firstChild.nodeValue; (so that only one image will be loaded initially to minimize load time)
if (j==80) then: one=one.alpha[(100-j)*5] (thus the original alpha is 100, and it decreases by values of 5 for each "j")
}
}
- rootNode = new XML();
- rootNode.ignoreWhite = true;
- rootNode.load("pictures.xml");
- rootNode.onLoad = function(success) {
- if (success) {
- var ef = rootNode.firstChild.childNodes;
- _global.ef=ef;
- }
- }
- //PSEUDOCODE BEGINS
- variable one=new movieclip;
- variable two=new movieclip;
- for(i=0;i<ef.length();i++)
- {
- one=box.load()=ef[i].firstChild.nodeValue; (where the value is the url of the image)
- for(j=0;j<100();j++)
- {
- if (j==50) then: two=text=ef[i+1].firstChild.nodeValue; (so that only one image will be loaded initially to minimize load time)
- if (j==80) then: one=one.alpha[(100-j)*5] (thus the original alpha is 100, and it decreases by values of 5 for each "j")
- }
- }
Thanks for any help, and please keep in mind that I am not familiar with the syntax for the part I wrote in the pseudocode section, so any corrections are appreciated. Note: this would crash after it reaches the end because at i=last and j=80, i +1 would not exist, but I did not deal with the error for simplicity.