numediaweb
January 9th, 2009, 05:10 AM
Hello Kirupians!
[Summary]
I want to load images from an XML, then store the images inside an array, then duplicate that array into other clone arrays so that I can addChild() copies of the images into stage whenever i want (and be able to change their properties).
Basicly i have to create two duplicates; big_img and icon_image
[SYMPTOMS]
Everything is loaded fine;the big_imgloads and positions correctly, but, when i try to load icon_image the first big_img disappears! as if the new array has hasn't duplicated the original array (as if it's only a shortcut, not a real copy).
The cody thing:
// total images read from XML
var axiLength=Accessoir.length();
// main image container array
var axxARR:Array = new Array();
// add images to array
for (var k=0; k<axiLength; k++) {
var axxLoader:Loader = new Loader();
axxLoader.load(new URLRequest(Accessoir.PHOTO.text()[k]));
axxARR.push(axxLoader);
axxLoader.contentLoaderInfo.addEventListener(Event .COMPLETE, axxLoaded);
}
function axxLoaded(e:Event):void {
// show big image
if (axiLength==axxARR.length) {
axxShow(0);
}
}
function axxShow(ID_AXX:Number) {
// duplicate images array
var axxImage:Array=axxARR.concat(axxARR);
// reposition it
axxImage[ID_AXX].x = product_details_swf.axx.x+(axxImage[ID_AXX].width/2)-5.5;
// Add init image to accessoires
axxImage[ID_AXX].name="axxImage";
product_details_swf.axx.addChild(axxImage[ID_AXX]);
}
// here i got an event listner to a button, once rolle over is triged it
// should make small copies of the whole array images and put them on stage
//....
function rollover_button(ID_AXX:Number) {
for (var i=0; i<axiLength; i++) {
axxCreate(i);
}
function axxCreate(ID_AXX:Number) {
var axxPic:Array=axxARR.concat();
imageResizer(axxPic[ID_AXX], 50, 50);
axxPic[ID_AXX].name="axxPic_"+ID_AXX;
axxPic[ID_AXX].x=product_details_swf.axx.getChildByName("axxBG_"+ID_AXX).x+axxPicSpacingX;
axxPic[ID_AXX].y=product_details_swf.axx.getChildByName("axxBG_"+ID_AXX).y+axxPicSpacingY;
product_details_swf.axx.addChild(axxPic[ID_AXX]);
}
}
[MORE INFORMATION]
I tried array duplication using; concat and slice but not work, it doesn't creat copies of the orriginal array, but just a shortcut to it!
thanx for any tips!
[Summary]
I want to load images from an XML, then store the images inside an array, then duplicate that array into other clone arrays so that I can addChild() copies of the images into stage whenever i want (and be able to change their properties).
Basicly i have to create two duplicates; big_img and icon_image
[SYMPTOMS]
Everything is loaded fine;the big_imgloads and positions correctly, but, when i try to load icon_image the first big_img disappears! as if the new array has hasn't duplicated the original array (as if it's only a shortcut, not a real copy).
The cody thing:
// total images read from XML
var axiLength=Accessoir.length();
// main image container array
var axxARR:Array = new Array();
// add images to array
for (var k=0; k<axiLength; k++) {
var axxLoader:Loader = new Loader();
axxLoader.load(new URLRequest(Accessoir.PHOTO.text()[k]));
axxARR.push(axxLoader);
axxLoader.contentLoaderInfo.addEventListener(Event .COMPLETE, axxLoaded);
}
function axxLoaded(e:Event):void {
// show big image
if (axiLength==axxARR.length) {
axxShow(0);
}
}
function axxShow(ID_AXX:Number) {
// duplicate images array
var axxImage:Array=axxARR.concat(axxARR);
// reposition it
axxImage[ID_AXX].x = product_details_swf.axx.x+(axxImage[ID_AXX].width/2)-5.5;
// Add init image to accessoires
axxImage[ID_AXX].name="axxImage";
product_details_swf.axx.addChild(axxImage[ID_AXX]);
}
// here i got an event listner to a button, once rolle over is triged it
// should make small copies of the whole array images and put them on stage
//....
function rollover_button(ID_AXX:Number) {
for (var i=0; i<axiLength; i++) {
axxCreate(i);
}
function axxCreate(ID_AXX:Number) {
var axxPic:Array=axxARR.concat();
imageResizer(axxPic[ID_AXX], 50, 50);
axxPic[ID_AXX].name="axxPic_"+ID_AXX;
axxPic[ID_AXX].x=product_details_swf.axx.getChildByName("axxBG_"+ID_AXX).x+axxPicSpacingX;
axxPic[ID_AXX].y=product_details_swf.axx.getChildByName("axxBG_"+ID_AXX).y+axxPicSpacingY;
product_details_swf.axx.addChild(axxPic[ID_AXX]);
}
}
[MORE INFORMATION]
I tried array duplication using; concat and slice but not work, it doesn't creat copies of the orriginal array, but just a shortcut to it!
thanx for any tips!