View Full Version : Animation using actionscript
LocoDave
05-10-2004, 08:34 AM
Hi Guys, just wondering if anyone know how i can animate sumpin like the fla provided by using actionscript instead of frame animation!
I just want an object to go across the screen and then loop again once it has reached the end point again.
Ive looked at the grass tutorial (kirupa sample), but couldnt get my head around it.
Thanks for ur help
Hi,
I didn't look at your file, but you could do something like that:from = 50 ;
to = 400 ;
speed = 10 ;
theClip.onEnterFrame = function () {
this._x += speed ;
if (this._x > to) this._x = from ;
} ;
This might work too:from = 50 ;
to = 400 ;
speed = 10 ;
theClip.onEnterFrame = function () {
this._x = (this._x + speed) % (to - from) + from ;
} ;I said might work :)
LocoDave
05-10-2004, 10:28 AM
thanks for ur code! got it working! just one thing, it flashs every now and then? why is that? it's not a full smooth animation, is that because it is actionscript rather then animated??
Thanks for ur help
here is the fla if u wanna see the flash im talking about!!
maybe your frame rate is to low...
if you use onEnterFrame, speed will always depend of your personal frame rate...
give it a try with setInterval to launch the function by time intervals...
cobo
LocoDave
05-10-2004, 10:40 AM
hey there, i tried the setInterval, and it didnt work, the mc didnt scroll across the page, it just flashed on the other end!!
Yes, use a higher frame rate, or decrease the speed :)
it's flashing because the circle movie clip has a single frame where you set it way off center.
Hi,
Edit ur circle mc,
remove all the frames except frame 1
run ur movie.
Now ur bug is fixed.
Yeee.......
|
vBulletin® v3.8.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.