Hi everybody!
I have a series of mc’s on the stage: but1, but2, but3… and I have an xml file which leads to an image.
I want each button to access the respective image.
This is the code:
function GeneratePortfolio(portfolio_xml) {
var portfolioPictures = portfolio_xml.firstChild.childNodes;
noclips = portfolioPictures.length;
for (var i = 0; i<noclips; i++) {
var currentPicture = portfolioPictures*;
[COLOR="Red"]var mc = "but"+(i+1);[/COLOR]
mc.title = currentPicture.attributes.title;
mc.image = currentPicture.attributes.image;
mc.thumb = currentPicture.attributes.thumb;
mc.onRollOver = mc.onDragOver=function () {
this._alpha = 100;
};
mc.onRollOut = mc.onDragOut=function () {
this._alpha = 75;
};
mc.onRelease = function() {
_root.pictureit.holder.loadMovie(this.image);
var colorful = new Color(this);
colorful.setRGB(0x666666);
};
}
}
var portfolio_xml = new XML();
portfolio_xml.ignoreWhite = true;
portfolio_xml.onLoad = function(success) {
if (success) {
GeneratePortfolio(portfolio_xml);
} else {
trace("error");
}
};
portfolio_xml.load("40.xml");
function disappear(target, newAlpha) {
target.onEnterFrame = function() {
this._alpha -= (this._alpha-newAlpha)*.1;
};
}
I think this is the line with the problem [COLOR=“Red”]var mc = “but”+(i+1);[/COLOR], because when I place but1, the but1 works.
Does anybody know which is the problem, or does anybody know a tutorial?
Thanks in advanced.