Hey all,
I’m having a problem that I can’t quite figure out. I’m attempting to create the “shop” section of a client’s website, which involves displaying the photos of the jewelry, and then loading the appropriate information when each of them are clicked on. The movie clip duplicates just fine, but the images are not showing up. The image URLS are loaded from an external XML file, as you can see in the code.
I have one instance of the movie clip on the stage with instance name “picContainer”. It contains a dynamic text field with instance name “loadPercent”. I’m trying to resize the JPGs to 100x100, despite the fact that they are much larger than that.
Thank you very much for your time!
Here’s the code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
var jxml:XML = new XML();
jxml.ignoreWhite = true;
var photos:Array = new Array();
jxml.onLoad = loadRocks;
var picX = picContainer._x;
var picY = picContainer._y;
var numOfImgs:Number;
function loadRocks() {
var jewels:Array = this.firstChild.childNodes;
for(i=0;i<jewels.length;i++) {
photos.push(jewels*.attributes.photo1);
trace(jewels*.attributes.photo1.toString());
}
trace("start LOADROCKS");
trace(photos.length);
trace("loadRocks");
for (var i=0; i<photos.length; i++) {
currContainer = "picContainer"+i;
var containerDup = picContainer.duplicateMovieClip(currContainer,i,{_x:picX,_y:picY,_alpha:0});
var empty = containerDup.createEmptyMovieClip("jpg_container",i*50);
empty._x = empty._y = 0;
empty._width = 100;
empty._height = 100;
containerDup.ID = i;
var picTween:Tween = new Tween(containerDup,"_alpha",Strong.easeIn,0,100,1,true);
//PRELOAD JPG-----------------
var loader:MovieClipLoader = new MovieClipLoader();
var preload:Object = new Object();
preload.onLoadProgress = function (targetMC,lBytes,tBytes) {
containerDup.loadPercent.text = Math.round((lBytes/tBytes)*100)+"%";
}
preload.onLoadInit = function () {
containerDup.loadPercent = "";
trace("loadCOMPLETE");
}
preload.onLoadError = function () {
trace("AN ERROR OCCURRED!");
}
loader.addListener(preload);
loader.loadClip(jewels*.attributes.photo1,containerDup.jpg_container);
//-------------------------------------
picX += 102;
numOfImgs++;
if (picX > 500) {
picX = 20;
picY += 102;
}
containerDup.onRelease = function () {
getURL("http://www.catharsiswd.com/sandbox/telemundo/"+this.ID,"_blank");
}
}
}
jxml.load("http://www.mar-artandstone.com/products.php");