PDA

View Full Version : Scrolling objects



hsadan
March 24th, 2002, 04:18 AM
How do I create random scrolling objects with different speeds?
(like the cars on kirupa's logo at the end of each tutorial)

ilyaslamasse
March 24th, 2002, 06:39 AM
Make a movie clip, and add the code :
onClipEvent (load) {speed = random (30) ;}
onClipEvent (enterFrame) {make the clip move}
This should give you a

hsadan
March 24th, 2002, 11:08 AM
erm...is that it? seems you got cut off ;)

ilyaslamasse
March 24th, 2002, 12:26 PM
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]

hsadan
March 24th, 2002, 12:46 PM
yeah kinda...just one more thing - where do i add the code? :s

ilyaslamasse
March 24th, 2002, 12:54 PM
When you have your movie clip, right click it and choose actions. It's in that panel.

pom 0]

hsadan
March 24th, 2002, 03:37 PM
k thx alot :) .

hsadan
March 24th, 2002, 04:49 PM
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

lobstars
March 24th, 2002, 05:02 PM
would you mind if I have a look at the script aswell please!
lobstars@hotmail.com

ilyaslamasse
March 24th, 2002, 05:22 PM
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]

hsadan
March 24th, 2002, 05:32 PM
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?

ilyaslamasse
March 24th, 2002, 05:43 PM
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]