-
Is there a way to place a radomized picture into a flash movie?? For example, you had 5 seperate images, all sized the same, and were loaded into the movie as a background, then each time the visitor came to the site, there was a potential of 5 different background he or she might see...
Any thoughts?? Anyone...Beuhler??
-
Ok
You put each of the 5 picures in a different frame, with a blank frame befor them all.
Then you make an invisible movieclip with 3 frames.
Frame1:
stop();
Frame2:
bg = random(6);
Frame3:
if (bg >= 1) {
gotoAndPlay (2);
} else {
_root.gotoAndPlay (bg);
gotoAndStop (1);
}
What this does, is generates a random number between 2 and 6, and tells the main timeline, to go to that frame.
Now, in the blank frame I mentioned befor, you simply put:
stop ();
_root.randomthing.gotoAndPlay (2);
good luck!
Oh and, you may need to put:
_root.gotoAndPlay (Number(bg));
instead of:
_root.gotoAndPlay (bg);
I think, but I cant remember if it is gotoAnd* that doesnt like having a variable in its arguments..
-
Thanks soooo much for the help...for some reason though, it the movie doesn't get past the first frame...
As for the invisible movie clip, I put that on a second layer...should I just have that on the first frame, or on each of the frames that contain a picture?? I would assume that it needed to be on the first frame so it could generate the random nubmer...
Thanks for you input!!
-
On frame 3 I think it should be
if (bg <= 1) {
gotoAndPlay (2);
-
you can also create one movieclip, create 6 keyframes. leave the first one blank, now in each frame from 2 to 6, insert one of the backgrounds.
then, add this code on the empty frame 1:
frame = random(8)+2;
gotoAndStop (frame);
-
Robson, ugh I can never use those symbols..
It has to be 'less than,' which ever that is.
random(8)+2; is a good idea, but it think its random(4)+2..?
[Edited by cym on 04-05-2001 at 10:34 AM]
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
|