-
Hi there,
is it possible to load external swf movies by using a loop?
This is what i want to do:
I have made a photo album with flash and I want to be able to add new albums to the main one without having to alter the main movie.
So I want the main movie to "search" for new album components and display them if they are found (eg 1.swf, 2.swf...etc).
I was thinking that if i created some sort of load movie loop i would be able to overcome this problem, unfortunatly i'm quite a sad actionscripter and i have no idea how to do this.
cheers
-
How about this:
on(press) {
i++;
loadMovie("movie0" + i + ".swf")
}
Go to the previous one by:
on(press) {
i--;
loadMovie("movie0" + i + ".swf")
}
And, yes, you could do it with a loop. You could set up an mc that contains the number of frames you wanted to process before the above core code is activated at the end.
-
thanx kenny
Thanx man, i'll give it a go.
-
problems, problems....
ok, I want the movie to scan for new swf's at the start of the movie (automatically-without button push).
I tried this script (don't laugh!!!!)
i = "1";
if (i<10) {
i++;
loadMovie("movie0" + i + ".swf",1+i)
} else {
stop();
But it doesn't seem to work...
Any ideas?
Thanx in advance!!!!
-
Where do you have this code?
Try:
i = 1;
if (i<10) {
i++;
loadMovie("movie0" + i + ".swf",1+i)
trace("I: " + i);
} else {
stop();
Remove the quotes around the one. Trace i so you can see what's happening.
-
hey again
Originally posted by Kennyb
Where do you have this code?
Try:
i = 1;
if (i<10) {
i++;
loadMovie("movie0" + i + ".swf",1+i)
trace("I: " + i);
} else {
stop();
Remove the quotes around the one. Trace i so you can see what's happening.
I've got it at the first frame of the main timeline (is that the right place?)
I put the trace in and i only get the output "i:2" somehow i don't think it's looping...
thanx again
-
i removed the quotes, but that gives me an error message...
-
Senior Member
To make a loop use "while" or "for":
Code:
i = 1;
while (i<10) {
loadMovie("movie0" + i + ".swf",1+i);
i++;
}
-
hi again,
ok I tried cancerinform's solution, but alas it still doesn't work, for some reason it won't pick up the variable.
eg:
loadMovie("movie"+"1"+".swf", 1); (this works)
x = "1";(or x=1)
loadMovie("movie"+x+".swf", 1); (this doesn't)
Any ideas??
cheers
-
If you want, I'll look at your fla. Please post it some place where it can be downloaded. If it is less than 1MB, you can email it to me at: aspirin99@hotmail.com. Please remind me in the email exactly what you are try to do and where the trouble is.
-
This should work.
i = 1;
while (i<=5) {
createEmptyMovieClip (mc+i, i);
loadMovie("movie" + i + ".swf",mc+i);
i++;
}
One more thing, the above code will check for files 1 to 6.
-
Thanks KennyB, I've also found out that this works as well:
i = 1;
while (i<10) {
loadMovieNum("movie" + i + ".swf",1+i);
i++;
}
Alls well that ends well!!!!!!!!!!!!!!!!
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
|