Groups | Blog | Home
all groups > flash actionscript > march 2004 >

flash actionscript : Movie clip action problem.


scourtaud
3/5/2004 8:57:54 PM
Hi,

I'm actually working on ? photo gallery and I am stuck with a problem.

Here it comes :

The gallery is dynamic. picture names are loaded from an external textfile
containing an array.
In a first movie, the array is loaded and a movieclip as many time as there
are picture names in the array. Then in each clip is loaded ? picture.
This movie is loaded into the main movie and displays reduced picture in wich
you can scroll.

The problem :

In the main movie, when you click on ? small picture, I would like it to send
the picture name to a movie clip that would display the picture in regular
size.
I can't manage to add an "on (Release)" action to each movie clip containing
the picture.

I've been there for a week now and I would love some help and be very
gracefull for it.

Thank you in advance.
maxil
3/5/2004 10:18:34 PM
Any chance of looking at your .fla or code as I had the same problem and was
able to overcome it.

What does the array contain? Is it the name of your photos your loading? If so
then you will be able to use the array.

Show me you code.

Thanks
Sam
I.D.
3/6/2004 2:25:17 AM
Once you load the image into a container, you lose the container as a
movieclip, therefor you can't reference it.
This will do:

this.createEmptyMovieClip("cont", 1);//initial 'parent' container
this.cont.createEmptyMovieClip("cont", 1);//actual container for loaded content
this.cont.cont.loadMovie("../Images/model1.jpg");
//then refer to loaded movie as:
this.cont._alpha = 50;
scourtaud
3/6/2004 1:25:27 PM
Thanks to you two.

So as asked, here is my code for loading the pictures :

this._lockroot = true;

mySimpleText = new LoadVars();
// use the loadVars.load() method to retrieve the textfile
mySimpleText.load("txt/info.txt");
// use the loadVars.onLoad() event to put the data in the textfield
mySimpleText.onLoad = function(success) {
if (success) {
myimg = this.test.split(",");
nbimg = myimg.length;
// Himg is used for scrolling ratio.
himg = (((nbimg-1)*70)-10)/2;

//this is how the arrai looks like each value except the first one being the
picture name without the extension.
// myimg =
["blanc","photo1","photo2","photo3","photo4","photo1","photo2","photo3","photo4"
,"photo1","photo2","photo3","photo4","photo1","photo2","photo3","photo4","photo1
","photo2","photo3","photo4","photo1","photo2","photo3","photo4","photo1","photo
2","photo3","photo4"];


count = 1;
nb = 1;
nb2 = 0;
while (count<nbimg) {

_root.box.duplicateMovieClip(["boxx"+count], count);
LoadMovie(myimg[count]+".jpg",_root["boxx"+count]);
if (nb == 1) {
myx = 0;
}
if (nb == 2) {
myx = 100;
}
myy = 0+(70*nb2);

_root["boxx"+count]._x = myx;
_root["boxx"+count]._y = myy;



count += 1;
if (nb == 2) {
nb = 0;
nb2++;
}
nb++;

}

}
};

I am now trying to adapt the second code in there...
scourtaud
3/6/2004 7:45:25 PM
Adapted the code and works (the pictures load fine) but the onrealease function
does not.

I guess because its located in a while { } with the rest but I can't see how
to get it to work eitherwise.


Help Again

thanks again
AddThis Social Bookmark Button