I am setting up a portfolio gallery that I have multiple images being loaded with the flash MovieClipLoader and that is working fine. The problem I am encountering is the following when all the images are done being loaded I call function setupHandlers(); which sets up each clip with onMouseUp events. But when I click on a mc it runs the event on all the the movie clips not the specific on I clicked on. Can somebody help me.
var THUMBW:Number = 74; // width of each thumbnail
var THUMBH:Number = 50; // height
var MARGIN:Number = 10; // margin between thumbnails
var PICPATH:String = “flash_pics/”;
var myLoaded:Number;
var myTotal:Number;
var myPercent:Number;
// set up loader, an instance of MovieClipLoader
var loader:MovieClipLoader = new MovieClipLoader();
//timeline to listen to and respond to loader’s broadcast events
loader.addListener(this);
function onLoadProgress(_mc:MovieClip, loaded:Number, totalloaded:Number) {
}
function grow() {
trace(this);
/*
this.onEnterFrame = function() {
if (this._width < THUMBW * 1.2) {
this._x -= this._width * .025;
this._y -= this._height * .025;
this._width *= 1.05;
this._height *= 1.05;
} else {
delete this.onEnterFrame;
}
} */
}
// thumbnail rollout handler
function shrink() {
trace(this);
/*
this.onEnterFrame = function() {
if (this._width > THUMBW) {
this._width /= 1.05;
this._height /= 1.05;
this._x += this._width * .025;
this._y += this._height * .025;
} else delete this.onEnterFrame;
}*/
}
function setupHandlers() {
for (var i:Number = 0; i < rvs.length; i++) {
thumbs_mc[“mc”+i].onMouseUp = grow;
//trace(thumbs_mc[“mc”+i]);
}
}
function onLoadInit(_mc:MovieClip) {
// this gets done when the jpg is completely loaded:
_mc._width = THUMBW;
_mc._height = THUMBH;
_mc._alpha = 100;
// give the movieclip a property to remind it who it is
// (used by openPic to know which big picture to open)
_mc.i = ipic;
// now load the next one (if there are more) or set up handlers if done
ipic++;
if (ipic == rvs.length) {
setupHandlers();
} else {
loader.loadClip(PICPATH + rvs[ipic].logo, thumbs_mc[“mc”+ipic]);
}
}
function init() {
var yMove:Number = MARGIN;
var xMove:Number;
var counter:Number = 0;
createEmptyMovieClip(“thumbs_mc”, 2);
thumbs_mc._x = 0;
thumbs_mc._y = 0;
// make empty movieclips in holder_mc for each pic to go into
for (var i:Number = 0; i < rvs.length; i++) {
var mc:MovieClip = thumbs_mc.createEmptyMovieClip("mc"+i, i+1);
// var name:String = “thumb_mc”+i;
// thumb_mc.duplicateMovieClip(name, i+1);
// thumb_mc._visible = false;
if(i%7 == 0 && i != 0){
yMove = i * yMove;
counter = 0;
}
xMove = counter * (MARGIN + THUMBW);
mc._x = xMove;
mc._y = yMove;
counter++;
}
// set the pointer to the first jpg in the array picnames
ipic = 0;
// start loading jpgs
loader.loadClip(PICPATH + rvs[ipic].logo, thumbs_mc[“mc”+ipic]);
}
//parses xml into array
var rvs = new Array();
var rvs_xml:XML = new XML();
rvs_xml.ignoreWhite = true;
rvs_xml.onLoad = function(success){
if(success){
parseFile(rvs_xml);
init();
}
}
function AccessPoint(lineTitle,logo, image, blurb, website, websiteTitle) {
this.lineTitle = lineTitle;
this.logo = logo;
this.image = image;
this.blurb = blurb;
this.website = website;
this.websiteTitle = websiteTitle;
}
function parseFile(rvs_xml) {
temp = new Array();
for (var a = 0; a<rvs_xml.firstChild.childNodes.length; a++) {
for (var b = 0; b<rvs_xml.firstChild.firstChild.childNodes.length; b++) {
if(b != 4){ //if not on last node
temp** = rvs_xml.firstChild.childNodes[a].childNodes**.firstChild.nodeValue;
}else{
temp** = rvs_xml.firstChild.childNodes[a].childNodes**.firstChild.nodeValue; //node website url
temp[b+1] = rvs_xml.firstChild.childNodes[a].childNodes**.attributes.vtitle; //last node website title
}
}
n = new AccessPoint(temp[0], temp[1], temp[2], temp[3], temp[4], temp[5]);
rvs.push(n);
}
}
rvs_xml.load(“xmldocs/recVehicles.xml”);