i have an image of a teady bear and i wanted to know if i could set up some random animation on this image.

What i want the image to do is move its are or blink an eye, only slight movements but for then to occur randomly. i know i could just set up a timeline so the image animates how i want along a set amount of time, but i would like it to randomly move in different ways so there is no set pattern to the movement,

if anyone could point me in the direction of a good tutorial that would be great or if someone can shoot me out the sky and tell me it cannot be done would also be good.

Recommended Answers

All 2 Replies

I believe this should work. Lets say that you have 2 animations that take 2 frames each(4 frames total):

var randomNumber = Math.floor(Math.random()*4)

if (randomNumber == 0){
gotoAndPlay(1);
}
if (randomNumber == 1){
gotoAndPlay(1);
}
if (randomNumber == 2){
gotoAndPlay(3);
}
if (randomNumber == 3){
gotoAndPlay(3);
}

thanks for the reply.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.