I’m looking to display three images, chosen at random on load, throughout the duration of a banner ad.
Basically, these images are health tips displayed on post it’s – as it plays, the post-it’s fly off, revealing the next tip. I also need ensure that the images don’t repeat.
I’m mostly a timeline guy, but I’ve been learning AS and have no problem getting one image to display randomly – however the three separate ones with no repeat is throwing me off.
My thoughts are to are to either
a) Put all the images on separate frame within 3 MC’s, and somehow display a random frame within that clip on load, ensuring no repeat
or
b) Load the images into 3 separate MC’s through and XML doc, and pick one at random.
Any thoughts or points in the right direction would be much appreciated.
EDIT – I should’ve clarified…
The images only appear one at a time – so I think each MC would only contain one of the 3 random images selected. So is it possible to load a random image into a MC, and then duplicate that MC without a chance of the image repeating?
I’m looking to display three images, chosen at random on load, throughout the duration
Share
Well, one way of doing this following your thoughts is:
Put the images in one mc.
Create an array containing the frame number corresponding to each image.
Shuffle that array to have a random order.
Play image frame using the frame from the shuffled array.
To shuffle the array you could use something like this:
to use the method, simply: