News:

If you need instructions on how to get through the hotels, check out the enclosed instruction book.

Main Menu

AS Assistance needed

Farted by GodClock, April 07, 2010, 04:08:07 PM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

GodClock

[FLASH]http://files.myfrogbag.com/uayavyvgtc2nqdd/helpplz.swf[/FLASH]
ok so im trying to animate this looping background and i would like to know how i can make the image that says "Random Clock" actually make a random clock appear from a set list, does anyone know of such a solution?
Sw@g
Quote from: Kodiakclock;1893997godclock probably now that I think about it. We could bro it out he could learn me how to surf and then we cruise bro our way out of there into brosville

AmberArachnidClock

Make a movieclip with a bunch of frames, each one with a different clock. Then on the first frame put this code:

randomframe = random(totalframes+1)
gotoAndStop(randomframe);

where totalframes is the total amount of frames. That should work.

GodClock

Quote from: Satellite (Virgin);1743537Make a movieclip with a bunch of frames, each one with a different clock. Then on the first frame put this code:

randomframe = random(totalframes+1)
gotoAndStop(randomframe);

where totalframes is the total amount of frames. That should work.

didn't work, it just plays the movie clip like a normal movie clip with all of the frames. would you at all be able to send me an example .fla?
Sw@g
Quote from: Kodiakclock;1893997godclock probably now that I think about it. We could bro it out he could learn me how to surf and then we cruise bro our way out of there into brosville

AmberArachnidClock

Okay I did some revising if this still doesn't work ill send you an fla.
First you might have to be using actionscript 2.0
Now put this code on the first frame of your movie clip, which should be blank.

totalframes=???
randomframe = random(totalframes-1)+2
gotoAndStop(randomframe);

Instead of ??? put the total frames in the movie clip. In the consecutive frames put your different clocks.

Thor

But satellite, that would only work once. Every time the image went by it would be the same clock.

Here's some better code; put it on the movieclip of the clock itself, not on a frame

onClipEvent(load){countDown = 0;}

onClipEvent(enterFrame){
if(countDown == 0){
countDown = ???;
this.gotoAndStop(random(????) + 1);
}
countDown--;
}
??? is the number of frames the animation loop of the clock passing the screen is, and ???? is the number of different clocks you have in the movieclip of random clocks


I used pretty much this exact code on Manquest to make the zooming images of gay stuff change randomly every time they relooped. I know for a fact this works because I just copy and pasted it from the .fla

EDIT: You still have to do like Sat said though and put all your clocks inside of the same movieclip on different frames.
Quote from: MafiaMettaurWhat the hell is with that shit you posted? You know what, I'm joining the Locks, just to stop stuff like you!
Quote from: polyhedronclockYou're a fucking clock, what else do you have?
To be fair, you don't have anything. Clocks are just machines that tick.

AmberArachnidClock

You could do mine if you reloaded the clip each time aka putting a blank keyframe between motion tweens. Your's is kind of overly complicated and if it got off by a frame would not work.

Thor

I don't know how you could manage to incorrectly count the number of frames in the loop, although I see the advantage of having it automatically re-run the script.

also your random(totalframes-1)+2 is wrong.

Lets assume he has 10 frames of clocks. Your math would create a range from 2-10, completely skipping the first frame.

randomframe = random(totalframes+1) is also wrong because it would create a range from 0 to 11.

Actionscript fight ITT
Quote from: MafiaMettaurWhat the hell is with that shit you posted? You know what, I'm joining the Locks, just to stop stuff like you!
Quote from: polyhedronclockYou're a fucking clock, what else do you have?
To be fair, you don't have anything. Clocks are just machines that tick.

AmberArachnidClock

I wrote in my post that the first frame should be kept empty.

I know that randomframe = random(totalframes+1) is wrong that's why I revised it.

RomanClock

Already fixed (just a slight adjustment to Satellites suggestion as well as an example FLA)
Thor: I wouldn't recommend programming like that, practice programming on frames and AS files.
lemayo lol :soups: