dynamically importing movies
Hey all,
I'm dynamically loading movies into a shopping cart using xml for a flash website i'm doing. It works great for one product, but when there are multiple products, the first product is just listed over and over again. Here is my code:
This is on the carts first frame:
[AS]
var thumb_spacing = 200;
// load variables object to handle loading of text
function GeneratePortfolio(portfolio_xml) {
var portfolioPictures = portfolio_xml.firstChild.childNodes;
number.text = "You have saved " + portfolio_xml.firstChild.childNodes.length + " of 15 saved items.";
for (var i = 0; i<portfolioPictures.length; i++) {
var currentPicture = portfolioPictures[i];
var currentThumb_mc = cartloader.createEmptyMovieClip("thumbnail_mc"+i, i);
currentThumb_mc._y = i*thumb_spacing;
currentThumb_mc.createEmptyMovieClip("thumb_contai ner", 0);
currentThumb_mc.thumb_container._xscale = 50;
currentThumb_mc.thumb_container._yscale = 50;
currentThumb_mc.thumb_container.loadMovie(currentP icture.attributes.style);
_root.fillColorOne = currentPicture.attributes.one;
_root.fillColorTwo = currentPicture.attributes.two;
_root.fillColorThree = currentPicture.attributes.three;
_root.fillColorFour = currentPicture.attributes.four;
_root.fillColorFive = currentPicture.attributes.five;
_root.fillColorSix = currentPicture.attributes.six;
_root.fillColorSeven = currentPicture.attributes.seven;
_root.fillColorEight = currentPicture.attributes.eight;
_root.fillColorNine = currentPicture.attributes.nine;
_root.fillColorTen = currentPicture.attributes.ten;
_root.bagsname = currentPicture.attributes.bagName;
_root.imagefile = currentPicture.attributes.image;
_root.imagexcoord = currentPicture.attributes.xcoord;
_root.ycoord = currentPicture.attributes.ycoord;
}
}
[/AS]
This is on the first frame of the movie being loaded into the flash (note* this is loaded using currentThumb_mc.thumb_container.loadMovie(currentP icture.attributes.style); where style is the product type.)
[AS]
bagsname.text = _root.bagsname;
var FillerColorOne = _root.fillColorOne;
onEnterFrame = function () {
iColor = new Color(this.one);
iColor.setRGB(FillerColorOne);
delete iColor;
var FillerColorTwo = _root.fillColorTwo;
twoColor = new Color(this.two);
twoColor.setRGB(FillerColorTwo);
delete iColor;
var FillerColorThree = _root.fillColorThree;
threeColor = new Color(this.three);
threeColor.setRGB(FillerColorThree);
delete iColor;
var FillerColorFour = _root.fillColorFour;
fourColor = new Color(this.four);
fourColor.setRGB(FillerColorFour);
delete iColor;
var FillerColorFive = _root.fillColorFive;
fiveColor = new Color(this.five);
fiveColor.setRGB(FillerColorFive);
delete iColor;
var FillerColorSix = _root.fillColorSix;
sixColor = new Color(this.six);
sixColor.setRGB(FillerColorSix);
delete iColor;
var FillerColorSeven = _root.fillColorSeven;
sevenColor = new Color(this.seven);
sevenColor.setRGB(FillerColorSeven);
delete iColor;
var FillerColorEight = _root.fillColorEight;
eightColor = new Color(this.eight);
eightColor.setRGB(FillerColorEight);
delete iColor;
var FillerColorNine = _root.fillColorNine;
nineColor = new Color(this.nine);
nineColor.setRGB(FillerColorNine);
delete iColor;
var FillerColorTen = _root.fillColorTen;
tenColor = new Color(this.ten);
tenColor.setRGB(FillerColorTen);
delete iColor;
var image = _root.imagefile;
imagePane.contentPath = image;
imagePane.scaleContent = true;
var xcoord = _root.xcoord;
var ycoord = _root.ycoord;
this.imagePane.content._x = xcoord;
this.imagePane.content._y = ycoord;
};
[/AS]
Now I believe what is happening is that because I’m setting my var as _root.fillColorOne for example, that when the AS creates the var through the xml, it is not adding the [i] property correctly, so that it would instead be _root.fillColorOne1, and thus then the product can't find the var. I hope you understand what I mean.
Any help would be greatly appreciated.
Thanks!
Mat
|