A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [help] My scrolling is jerky

  1. #1
    Senior Member Ray Beez's Avatar
    Join Date
    Jun 2000
    Posts
    2,793

    [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;
    	}
    };
    Attached Files Attached Files

  2. #2
    Senior Member mbenney's Avatar
    Join Date
    Mar 2001
    Posts
    2,744
    Im assuming this is just one long clip containing all the photos? If so its just the refresh rate of the flash player. sucky indeed. i would make each photo into separate mcs and then only scroll them when they should be visible in the window.

  3. #3
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Could it be because you reset scroller to 0 whenever it is over scenesizex? I would imagine it is never exactly at that position so placing it to 0 would make slight nudge. I would not set it to exact coordinate, but add/substract the width:

    if (pos < scenesizex) {
    this.SCROLLER._x += scenesizex;
    }
    if (pos > 0) {
    this.SCROLLER._x -= scenesizex;
    }

  4. #4
    Senior Member Ray Beez's Avatar
    Join Date
    Jun 2000
    Posts
    2,793
    Quote Originally Posted by tonypa
    Could it be because you reset scroller to 0 whenever it is over scenesizex? I would imagine it is never exactly at that position so placing it to 0 would make slight nudge. I would not set it to exact coordinate, but add/substract the width:

    if (pos < scenesizex) {
    this.SCROLLER._x += scenesizex;
    }
    if (pos > 0) {
    this.SCROLLER._x -= scenesizex;
    }
    If that was the source of the jerkiness, it would only happen once every 10 to 15 seconds. The clip being scrolled is about 4600 pixels wide.

    *I just did a test with only 3 small photos and the "jump" still exists.

    .
    Last edited by Ray Beez; 11-01-2005 at 07:54 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center