-
Quick Question
I am sure the answer is no but I thought I would ask.
I am using thsi script in my movie for easing.
onClipEvent(load)
{
var Targetx=Picture.Home._x;
var Speed=.085;
}
onClipEvent(enterFrame)
{
var xDistance=Speed*Math.sqrt(Math.pow((Picture._x+Tar getx)-_parent.View._x,2));
if((Picture._x+Targetx)>=_parent.View._x)
{
Picture._x-=xDistance;
}
else if((Picture._x+Targetx)<=_parent.View._x)
{
Picture._x+=xDistance;
}
}
The one thing I notice is taht when my image is almost in place I get a little jerky movement. It is nto so bad but for the last two pixels or so I get a jerky movemnt that I would like to smooth out. Is there anyway to make it smoother?
Thanks for the help.
-
Senior Member
Try this instead:
Code:
onClipEvent (load) {
var Targetx = 300;
var Speed = .085;
}
onClipEvent (enterFrame) {
Picture._x += (Targetx-Picture._x)*Speed;
}
-
Not working
I tried you code and I may have done something wrong. I replaced all of my code with yours but then when I ran my movie the movie clip just shot off my stage. I am not sure if I did something wrong or not.
Any suggestions?
Thanks
-
Senior Member
My code was just a sample, and I'd set Targetx to 300. You need to modify the Targetx variable to match your desired "target x postion".
Based on what you first posted it would probably be this.
Code:
onClipEvent (load) {
var Targetx = Picture.Home._x;
var Speed = .085;
}
onClipEvent (enterFrame) {
Picture._x += (Targetx-Picture._x)*Speed;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|