damian_d
02-10-2006, 02:19 AM
I'm somewhat new to flash. I've got some slow-moving text, and I've always found tweens to be rather jittery. I was convinced it was because of the precision of the coordinate system in flash. It can only increment _y or _x by 0.1 at least. So I was guessing any tween that worked out to be an increment of say 0.13 per frame got rounded up or down from frame to frame, and therefore caused the tween to be jittery.
So then, my next idea was to increment using a fixed value in actionscript, and then my problems should be solved, right? Here's the code:
onClipEvent (load)
{
instMovingText3._y = 80; //just placing it anywhere
}
onClipEvent (enterFrame)
{
instMovingText3._y -= 0.9; //decrease _y by 0.9 every frame
instMovingText3.instText.text = instMovingText3._y; //display _y value
}
So basically, this thing makes the text move up the screen slowly, by increments of 0.9. Precision is at 0.1, so I shouldn't get any rounding errors, right? Here's where it gets crazy. Below is the sequence of _y values that I've set to display in the text object.
79.1 //after first increment. 80 - 0.9 = 79.1
78.2
77.3
76.4 //everything going fine so far
75.5
74.6
73.7
72.8
71.85 //71.85?? Where did that come from?? I was expecting 71.9!
70.95
70.05
69.1 //At this point, we've gained a 0.1 somewhere. From where??
68.2
It continues like that, occasionally including those 0.05's here and there. Very strange.
I know this may sound very trivial to some of you -- I know, why do I need it to be so precise -- but it's totally perplexing me and if anyone has any ideas, I'd greatly appreciate it. Or, if you know any other way to keep slow-moving tweens from being jittery, please share. Cheers!!!
Damian
So then, my next idea was to increment using a fixed value in actionscript, and then my problems should be solved, right? Here's the code:
onClipEvent (load)
{
instMovingText3._y = 80; //just placing it anywhere
}
onClipEvent (enterFrame)
{
instMovingText3._y -= 0.9; //decrease _y by 0.9 every frame
instMovingText3.instText.text = instMovingText3._y; //display _y value
}
So basically, this thing makes the text move up the screen slowly, by increments of 0.9. Precision is at 0.1, so I shouldn't get any rounding errors, right? Here's where it gets crazy. Below is the sequence of _y values that I've set to display in the text object.
79.1 //after first increment. 80 - 0.9 = 79.1
78.2
77.3
76.4 //everything going fine so far
75.5
74.6
73.7
72.8
71.85 //71.85?? Where did that come from?? I was expecting 71.9!
70.95
70.05
69.1 //At this point, we've gained a 0.1 somewhere. From where??
68.2
It continues like that, occasionally including those 0.05's here and there. Very strange.
I know this may sound very trivial to some of you -- I know, why do I need it to be so precise -- but it's totally perplexing me and if anyone has any ideas, I'd greatly appreciate it. Or, if you know any other way to keep slow-moving tweens from being jittery, please share. Cheers!!!
Damian