-
Abandon all Hope
Can this be done in an array???
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.
code: container_1._alpha = 0;
this.onEnterFrame = function() {
loadMovie("image1.jpg", "container_1");
Any help's appreciated!
regards
-
something like
for(var cnt=0; cnt<6; cnt++){
var mc = eval("container_"+cnt);
mc._alpha = 0;
mc.onEnterFrame = function() {
loadMovie("image1.jpg","container_"+cnt);
}
}
-Mav
-
Abandon all Hope
Thanks for your reply!
I got it to work, now have a follow up question:
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?
Thanks again,
regards
-
instead of a for statement, put the code inside a function and use setInterval to call the function. You can control the timing thus.
ofcourse you need maintain 'cnt' at each function call.
-Mav
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|