5/18/2010

Parallax Scrolling

Code snippet for parallax scrolling.
var xDist = mouseX/stage.stageWidth; target.x = -xDist *(target.width - stage.stageWidth);

5 comments:

  1. what is the full code?

    ReplyDelete
  2. do you mean source code-fla?
    I didn't post it because it's just 3 movieclips (width longer than stage) named bg1 to bg3. Then just copy paste the code above. That is the full code.

    ReplyDelete
  3. carmichael8412/11/2011 6:02 AM

    http://carmichael84.altervista.org/asadexperiment/

    Parallax scrolling in javascript experiment.
    I'm looking for developers to help me in an opensource library project: carmichael84@hotmail.it

    ReplyDelete
  4. Fantastic and simplistic, great article. Had been browsing for examples and knew there was a more fluid and simple method to achieve this other than the many examples online which go from hundreds of lines of code to several indepth classes which blow your mind.

    Love it, keep up the great work, helps us all keep some sanity when trying to appreciate the joy/hate of AS3. . .

    ReplyDelete