PDA

View Full Version : Can this be done in an array???



Inflicted
October 21st, 2003, 10:51 AM
I have a movie with 6 containers that load jpg's: container_1, container_2 etc.
They all have the same action. Instead of copying the code for every instance, can I put this in an array?

How would I do that? Couldn't find the appropriate tut or thread.


container_1._alpha = 0;
this.onEnterFrame = function() {
loadMovie("image1.jpg", "container_1");

Any help's appreciated!

regards

pom
October 21st, 2003, 11:41 AM
This question has been answered many times :)

claudio
October 21st, 2003, 11:47 AM
And your code makes no sense to me....
why is the loadMovie inside the onEnterFrame handler? You could just use loadMovie

senocular
October 21st, 2003, 11:52 AM
Originally posted by Ilyas da Pom
This question has been answered many times :)

This, apparently, is not one of those times :P

Inflicted
October 21st, 2003, 11:54 AM
Just couldn't find the right thread. But I know how to do it now...
The code is indeed not right, but just a shortened example. Not very clever I admit.

Got a follow up question if you guys still have patience with me...

I want the containers to load the jpg's with some delay between loading container_1, container_2 etc.

I tried putting the containers on a seperate frame, container_1 on frame 1, container_2 on frame 2 etc...Doesn't work.

Do you know of a way to do this? I' m just trying to expand my knowledge on AS.

Thanks again,

regards

senocular
October 21st, 2003, 11:58 AM
use setInterval

Inflicted
October 21st, 2003, 12:05 PM
Thanks senocular,

Do you have a tut or thread on this?

regards

senocular
October 21st, 2003, 12:24 PM
not on that exactly, but on setInterval, yes.

http://www.umbc.edu/interactive/flash/tutorials/showpage.php?p=setInterval