Hi there!
I’ve asked collegues and others, noone seems to have an answer to this.
I’m making a site that uses the Parallax Scroll effect, that is, when mouse moves and the movie scrolls, different layers move with different speeds - making it appear a bit 3-D.
Thing is, the original “world” which I import from Photoshop is very large, more than 9000 pixels wide, I don’t know if this actually is the problem, but here it goes:
It skips, or hitches, from time to time. I of course want it to run smoothly.
I’ve tried several things but nothing seems to work:
- cacheAsBitmap (the images are not animated)
- altering frameRate
- cutting large images into smaller sections, removing and adding these both with visible=false and removeChild
- easing up calculations so I can avoid decimals and stuff
- allow smoothing/compress
etc
Here’s the latest code for the actual scrolling (the details, being how the different layers move relatively, is in the separate .swf where the images are):
public function scrolling(evt:Event) {
var maxSpeed:Number = 12;
var pos:Number = mouseX / thisStageWidth;
var speed:Number = maxSpeed * pos; // Speed from 0-12
speed -= maxSpeed / 2; // Speed from -6 to +6
speed = -speed; // Reverse +/- values
//trace(Math.round(speed));
parallaxLayers.x += Math.round(speed);
//trace(parallaxLayers.x);
currentSpeed = speed;
parallaxLayers.movement = (speed > 0 ? "left" : "right");
parallaxLayers.currentSpeed = currentSpeed;
parallaxLayers.parentXposition = Math.abs(parallaxLayers.x);
parallaxLayers.moveLayers();
parallaxLayers.checkChildren();
}
parallaxLayers is the .swf to “talk to”, so I send these values into that .swf.
I’ve put the latest version up here so you can watch the hick-ups.
NOTE: I’ve messed with bits of the code here (when you go left in the beginning it has no borders), and I’ve turned off the actual Parallax Scroll-feeling.
Thanks!