I’m struggling with my XML thumbnails gallery. The gallery itself is set up without a problem, nice grid of images created, including a listener etc. But then… In my mc.onRelease function, I can’t the the node ID to pass through. And I really need it to so I can create the enlargement of the image…
Here’s my full code so far. Any help would greatly be appreciated. Oh, and I’m in a bit of a hurry
stop();
import com.erwinverdonk.flash.effects.Reflection;
/* SET BASIC VARS */
var startX = 0;
var startY = 0;
var bigX = 16;
var bigY = 12;
var space = 10;
var count = 0;
var maxCount = 3;
var speed = 5;
/* end basic vars */
/* LOAD XML FILE */
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.load("cat2010.xml");
myXML.onLoad = function(success) {
if (success) {
imageURL = [];
var xmlNode = myXML.firstChild.childNodes;
_root.totalImg = xmlNode.length;
for (i=0; i<_root.totalImg; i++) {
var imageNumber = i+1;
imageURL* = xmlNode*.firstChild.nodeValue;
}
loadImages();
}
};
/* end xml load */
/* CREATE CONTAINTER MOVIECLIP */
this.createEmptyMovieClip('container', this.getNextHighestDepth());
with (_root.container) {
moveTo(0, 0);
beginFill(0xFFFFFF);
lineTo(850, 0);
lineTo(850, 250);
lineTo(0, 250);
endFill();
}
/* end container create */
/* LOAD IMAGES */
function loadImages() {
for (i=0; i<_root.totalImg; i++) {
var my_mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
var imgHold:MovieClip = container.createEmptyMovieClip(i, container.getNextHighestDepth());
var img = imageURL*;
mclListener.onLoadProgress = function(mc:MovieClip, numBytesLoaded:Number, numBytesTotal:Number):Void {
mc._visible = false;
};
mclListener.onLoadInit = function(mc:MovieClip):Void {
mc._visible = true;
mc._alpha = 0;
mc.onEnterFrame = function() {
if (mc._alpha < 100) {
mc._alpha += Math.ceil((100 - mc._alpha) / speed);
}
}
};
my_mcl.addListener(mclListener);
my_mcl.loadClip(img, imgHold);
imgHold._x = startX;
imgHold._y = startY+count*95;
imgHold._xscale = 34;
imgHold._yscale = 34;
imgHold.onRelease = function() {
growImage(imageURL*);
}
startY = startY+space;
if (count<maxCount-1) {
count++;
} else {
count = 0;
startX = startX+270+space;
startY = 0;
}
}
}
/* end image load */
/* GROW IMAGE */
function growImage(link) {
trace(link);
}
/* end grow image */
/* SHRINK IMAGE */
function shrinkImage() {
trace(link);
}
/* end shrink image */
var myRefl:Reflection = new Reflection(container); // reference the MovieClip here
myRefl.addReflection(50, 150, "bottom", 2, 200);
// the above parameters are as follows below, adjust above items as needed/desire
// addReflection(alpha:Number, scaleY:Number, position:String, distance:Number, interval:Number)