Scrolling objects

How do I create random scrolling objects with different speeds?
(like the cars on kirupa’s logo at the end of each tutorial)

Make a movie clip, and add the code :

 onClipEvent (load) {speed = random (30) ;}
onClipEvent (enterFrame) {make the clip move}

This should give you a


erm…is that it? seems you got cut off :wink:

Looks like I was cut off… But the code is there. I just didn’t write the code that makes the clip move. Simply something like _x += speed ;
Is everything clear ?

pom 0]

yeah kinda…just one more thing - where do i add the code? :s

When you have your movie clip, right click it and choose actions. It’s in that panel.

pom 0]

k thx alot :slight_smile: .

Then again…looks like I’ll need more practice.

Could you post the entire script and explain it? I don’t really get it…

Thanks

would you mind if I have a look at the script aswell please!
[email protected]

Create a square. Turn it into a movie clip. Right click it and open the Actions Panel. Write :

  onClipEvent (load) {speed = random (30) ;}
onClipEvent (enterFrame) {_x = _x + speed ;}

pom 0]

I finally got it :P. Thanks alot!

just one more thing…how do i control it’s direction? I uderstand _y makes it go vertical, _x makes it go horizontal. But how do i control whether to go left or right, up or down?

Well, a positive speed will make it go right, a negative speed will make it go left.
You can do the same replacing _x by _x, but be careful : the _y axis is directed downwards.

pom 0]