This content has been marked as final. Show 3 replies
Normally I would create a behavior and attach it to the sprite that contains
the first image. There are many, many ways to do this. You'll need a
timer. You could create your own or use a timer object. The time check
should be in the exitFrame handler of the behavior and when the timer
expires (4 seconds in your case) it would trigger the changing of an image
and then reset itself for another 4 seconds.
Somehow you'll need to let the behavior know what the inventory of images
is. I would probably create a separate cast and cycle through the non-empty
cast members in that cast.
In programming there are endless opportunities for error checking, for
example, checking to make sure the cast member you're about to use is not
empty and if it isn't to make sure it's an image member and not something
else. Coding with this in mind avoids errors but also can add a lot of
(often valuable but necessary) time to the coding process.
If you need some code written just say so.
Craig S. Wollman
Word of Mouth Productions
159-00 Riverside Drive West
New York, New York 10032
"SimonBaum09" <firstname.lastname@example.org> wrote in message
> I would like to have swapping images (randomly) on one frame (not randomly
> change between frames). Each image should be shown four seconds, then
> with another random image. The swap is done automatically every four
> Can you give me some advise how this can be done? Thanks very much!
> Regards, Simon Text
Thanks very much for your answer. I tried some coding but I'm just not experienced enough. Could you show me some code examples please, especially the behaviour, that is attached to the sprite.
Well, there are 3 steps. One is to make the sprite so it can change
images. Two is to make a timer that changes it. And three is setting it
up to pick a random one. So, you would put this on the #bitmap sprite
that you want to be changeable...
on changeImage me, vMemberName
And this in a #movie script (NOT a behaviour). Watch for inadvertent
line breaks due to the forum system... and I just did this off the top
of my head, so I apologize for any accidental misspellings...
--start the timeout to go off every 4 secs
vTimeOut = timeOut("FourSecTimer")
if ilk(vTimeOut) = #timeout then vTimeOut =
else vTimeOut = timeOut().new("FourSecTimer", 4000, #FourSecTimer )
--define the list of images that will be changable
gPicList=["image 1","image 2","All","the","memberNames",'that","you","want"]
--pick a random number from the number of images in the list
It would be best if the images were all the same size. If they are not,
then you'd have to write a little more code to make the image fit into
the right size.