1 Attachment(s)
[help] My scrolling is jerky
I am using slightly old-school easy methods to scroll some clips and it's smooth for the most part, but every second there's like an extra "jerk" visible in the scrolling. If you count in your head, 1, 2, 3, 4 that pretty much is what i see. My scrolling jerks every second as if it's being "double-incremented", on a steady cycle, yet my code is super-simple, I can't figure out what's causing this.
I know this isn't really game related, but the experts in here seem to know alot more about optimized graphics performance, so I posted here.
Check out the attached SWF. This is my code in frame 1:
Code:
var update = 0;
var pos;
// Your visible window width
var screensize = 689;
var halfx = int(screensize / 2);
// Your photos clip width and height
var scenesizex = 2159;
var scenesizey = 259;
var sensitivity = -30;
// don't touch this:
scenesizex *= -1;
stop();
//
this.onEnterFrame = function() {
// calculate the distance & speed
update = int((this._xmouse - halfx) / sensitivity);
// update the panorama scene
pos = this.SCROLLER._x += update;
// check if scene is wrapping and adjust accordingly
if (pos < scenesizex) {
this.SCROLLER._x = 0;
}
if (pos > 0) {
this.SCROLLER._x = scenesizex;
}
};