I have got lost a bit with this flash i am doing at moment , i will try to explain the best i can and i'll post the code as well so u can see what i've done .
I am using Action script 2, i have an XML with photos , at the moment are 7 photos in there. The code i have at the moment just simply reads from the xml all the photos adn display them in a movie clip .
This is the code so far :
Expand|Select|Wrap|Line Numbers
- step_sel_img.onRelease=function(){
- myPhoto = new XML();
- myPhoto.ignoreWhite = true;
- thumbnails._visible=true;
- thumbnails.background=0xD8D8D8;
- myPhoto.onLoad = function(success) {
- //portfolioTag = this.firstChild;
- numimages = this.firstChild.childNodes.length;
- spacing = 70;
- for (i=0; i<numimages; i++) {
- this.picHolder = this.firstChild.childNodes[i];
- this.thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
- this.thumbHolder._x = i*spacing;
- this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 0);
- this.thumbLoader.loadMovie(this.picHolder.attributes.thmb);
- this.thumbHolder.title = this.picHolder.attributes.title;
- this.thumbHolder.main = this.picHolder.attributes.main;
- this.thumbHolder.onRelease = function() {
- grass_bcg.visible=true;
- loader.loadMovie(this.main);
- title_txt.text = " Price = " + this.title;
- };
- }
- };
- myPhoto.load("xmlphoto.xml")
Everything is working fine .
Now ..what i want to do is :
i want to set up an array that holds all the images ( before to display them ), and for each of the image i also have other fields like for ex:
image1 contains , name , price, thumbnail, main
The reason i want to do this is that when all images are loaded in the array, then i can set up some button back and forward to display like 3 at the time instead of all.
So basically i need an arary of array ( 2d array) , bust i got lost doing this
I'll put the code below to show u what i've tried to do , and if anyone can tell me what i'am doing wrong .
Expand|Select|Wrap|Line Numbers
- step_sel_img.onRelease=function(){
- myPhoto = new XML();
- myPhoto.ignoreWhite = true;
- thumbnails._visible=true;
- thumbnails.background=0xD8D8D8;
- myPhoto.onLoad = function(success) {
- //portfolioTag = this.firstChild;
- numimages = this.firstChild.childNodes.length;
- spacing = 60;
- for (i=0; i<numimages; i++) {
- this.picHolder = this.firstChild.childNodes[i];
- this.thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
- this.thumbHolder._x = i*spacing;
- this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 0);
- // testing --------------
- //images[i]=i;
- images = new Array (3);
- images[0]= this.picHolder.attributes.title;
- images[1]= this.picHolder.attributes.price;
- images[2]= this.picHolder.attributes.main;
- images[3]= this.picHolder.attributes.thmb;
- lastimage=i;
- newArray = new Array();
- //newArray[i].push(images)
- set("countArray"+i, images);
- trace (countArray);
- //for (var a=0;a<4;a++)
- // {
- // this.picHolder = this.firstChild.childNodes[a];
- // this.thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+a, a);
- // this.thumbHolder._x = i*spacing;
- // this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 0);
- // this.thumbLoader.loadMovie(images[a][3]);
- // this.thumbHolder.title = images[a][0];
- // this.thumbHolder.main = images[a][2];
- //
- // }
- // testing ------------------
- this.thumbLoader.loadMovie(this.picHolder.attributes.thmb);
- this.thumbHolder.title = this.picHolder.attributes.title;
- this.thumbHolder.main = this.picHolder.attributes.main;
- this.thumbHolder.onRelease = function() {
- grass_bcg.visible=true;
- loader.loadMovie(this.main);
- title_txt.text = " Price = " + this.title;
- };
- }
- trace (images);
- };
- myPhoto.load("xmlphoto.xml");
- };
Thanks.