ericaalicen
Programmer
I'm attempting to load some images into flash from xml. I'm attempting to loop through the xml and load the images, and set rollover, rollout, and onclick actions. I'm having trouble with the syntax. The rollover works, but the rollout doesn't. I have the images loading statically outside of the loop, but want them inside the loop. I can't get the syntax for that either.
I would greatly appreciated some help with this.
Code:
// call mcLogos movie clip
this.attachMovie("mcLogos", "bLogos", 3);
bLogos._x = 400;
bLogos._y = 250;
var myXML:XML = new XML();
myXML.ignoreWhite=true;
myXML.load("company.xml");
myXML.onLoad = function(success) {
if (success) {
var myImage = myXML.firstChild.childNodes;
for (i=1; i<myImage.length; i++) {
var imageNumber = i;
var imageID = myImage[i].attributes.id;
var imageURL = myImage[i].attributes.img;
trace ("My image number "+imageNumber+" ID is "+imageID+" and its filename is "+imageURL+".")
trace(mcSquares["square"+i]);
// rollover effect for squares
mcSquares["square"+i].ID = i;
mcSquares["square"+i].onRollOver = function(): Void {
mcSquares["square"+this.ID]._visible = false;
};
// rollout effect for squares
this["mcLogo"+i].ID = i;
this["mcLogo"+i].onRollOut = function(): Void {
trace(mcSquares["square"+i]);
mcSquares["square"+i]._visible = true;
};
// onclick
this["mcLogo"+i].onRelease = function () {
getURL("press.cfm?id=+imageID+");
};
}
} else {
trace ("XML not loaded.");
}
};
// load external images, I want to put this in the above loop
this.mcLogo1.logo1Text.htmlText = "<img src=\"flashImages/pp1.jpg\">";
this.mcLogo2.logo2Text.htmlText = "<img src=\"flashImages/pp2.jpg\">";
this.mcLogo3.logo3Text.htmlText = "<img src=\"flashImages/pp3.jpg\">";
this.mcLogo4.logo4Text.htmlText = "<img src=\"flashImages/pp4.jpg\">";
this.mcLogo5.logo5Text.htmlText = "<img src=\"flashImages/pp5.jpg\">";
this.mcLogo6.logo6Text.htmlText = "<img src=\"flashImages/pp6.jpg\">";
this.mcLogo7.logo7Text.htmlText = "<img src=\"flashImages/pp7.jpg\">";
this.mcLogo8.logo8Text.htmlText = "<img src=\"flashImages/pp8.jpg\">";
this.mcLogo9.logo9Text.htmlText = "<img src=\"flashImages/pp9.jpg\">";
this.mcLogo10.logo10Text.htmlText = "<img src=\"flashImages/pp10.jpg\">";
this.mcLogo11.logo11Text.htmlText = "<img src=\"flashImages/pp11.jpg\">";
this.mcLogo12.logo12Text.htmlText = "<img src=\"flashImages/pp12.jpg\">";
this.mcLogo13.logo13Text.htmlText = "<img src=\"flashImages/pp13.jpg\">";
this.mcLogo14.logo14Text.htmlText = "<img src=\"flashImages/pp14.jpg\">";
this.mcLogo15.logo15Text.htmlText = "<img src=\"flashImages/pp15.jpg\">";
this.mcLogo16.logo16Text.htmlText = "<img src=\"flashImages/pp_blank.jpg\">";
this.mcLogo17.logo17Text.htmlText = "<img src=\"flashImages/pp_blank.jpg\">";
this.mcLogo18.logo18Text.htmlText = "<img src=\"flashImages/pp_blank.jpg\">";
I would greatly appreciated some help with this.