Hi everybody!,
I’ve been struggling with this problem for months, let’s see if you can figure this out.
I want to create a template for several projects.
Each project has it’s own folder (projects/01; 02; 03; 04; etc) and each folder (project) has a different amount of images inside, so My Problem is that i cannot create a template having the Array in the .FLA file (cause every project is different)
So what i want to do, is to create the array for each project in an XML file and to load it in to the FLA template, so my the only thing i’ll have to change is the XML for every project instead of the FLA.
Down here is part of the code i’m currently using to show the images, it works perfectly but as it is, i can’t use it as a template.
[FONT=Courier New][SIZE=2][COLOR=Red][COLOR=SlateGray] //<array>[/COLOR][/COLOR][/SIZE][/FONT]
[FONT=Courier New][SIZE=2][COLOR=Red][COLOR=SlateGray] //this in red, is the array that i want to move to the xml file[/COLOR][/COLOR][/SIZE][/FONT]
[FONT=Courier New][SIZE=2][COLOR=Red][COLOR=SlateGray] //and load it back in here.[/COLOR][/COLOR][/SIZE][/FONT]
[FONT=Courier New][SIZE=2][COLOR=Red] var imagens:Array = new Array("projects/[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=Red]01/[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=Red]image01.jpg", "projects/01/image02.jpg", "projects/[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=Red]01/[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=Red]image03.jpg", "projects/[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=Red]01/[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=Red]image04.jpg");[/COLOR][/SIZE][/FONT]
[FONT=Courier New][SIZE=2][COLOR=Red] var titulos:Array = new Array ("titulo 1", "[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=Red]titulo [/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=Red]2", "[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=Red]titulo [/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=Red]3", "[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=Red]titulo [/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=Red]4"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=Red]);[/COLOR][/SIZE][/FONT]
[FONT=Courier New][SIZE=2][COLOR=Red][COLOR=SlateGray]//</array>[/COLOR][/COLOR][/SIZE][/FONT]
[SIZE=2][FONT=Courier New]var nId:Number = -1;[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] var nIm:Number = 0;[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] //[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] desc_txt.html = true;[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] desc_txt.autoSize = "right";[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] total_txt.html = true;[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] total_txt.autoSize = "right";[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] //[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] function proxImg():Void {[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] if (nId == imagens.length-1) {[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] trace("end");[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] } else {[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] nId += 1;[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] nIm += 1;[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] attachMovie("img_mc", "img_mc"+nIm, nIm+1);[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] eval(["img_mc"+nIm])._x = offset_left;[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] eval(["img_mc"+nIm])._y = offset_top;[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] this.alphaTo(100, 0, "linear", 0, function () {[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] eval(["img_mc"+nIm]).mcl.loadClip(imagens[nId], eval(["img_mc"+nIm]).alvo_mc);[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] });[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] desc_txt.htmlText = (titulos[nId].toLowerCase());[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] desc_txt._alpha = 0;[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] desc_txt.alphaTo(100, 1);[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] //[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] atual = addZero((nId+1), 2);[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] total = addZero(imagens.length, 2);[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] total_txt._alpha = 0;[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] total_txt.alphaTo(100, 1);[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] total_txt.htmlText = atual+"<font color='#999999'>"+"/"+total+"</font>";[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] }[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] }[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] //[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] function addZero(n, q):String {[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] var str = Math.pow(10, (q-n.toString().length)).toString().substr(1)+n;[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] return str;[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] }[/FONT][/SIZE]
[SIZE=2][FONT=Courier New] //[/FONT][/SIZE]
I’m not good with XML…
I’ll appreciate your help
thanks in advance!