Simple AS3 Parallax System Engine

This movie requires Flash Player 10

AS3 Parallax Engine Source Code (3739)

A recent project required me to set up a parallax system, of which I’ve done a hundred times probably, starting with AS1. However, I’d never built a class to handle this rather simple functionality. With this project request, I thought that I’d just re-purpose my AS3 Auto-Panning Class. However with my Auto-Panning Class, I realized I’d have to create Auto-Panning instances for each layer of the parallax system which seemed a bit much. I went ahead and moved forward with that, but then realized my Auto-Panning Class is set up to run an ENTER_FRAME event upon mousing over an invisible button. Needless to say, stacking Auto-Panning instances wouldn’t allow lower depths to become mouse-interactive. So, I scrapped that idea and built a rather simple parallax system.

I built the first class which works fine, but knew there were a few other capabilities that I should explore. So, I sub-classed my ParallaxEngine Class and created two additional Classes. One class will allow the parallax plates (any of the layered DisplayObjects within the parallax instance) to return to their predetermined x,y positions if the mouse leaves the designated mouse-active area. Another Class will allow the plates to continue moving slightly and ease to a stop when the mouse leaves the designated mouse-active area.

I’ve provided ASDocs with this set of files along with the FLA and source code – enjoy!

AS3 Parallax Engine Source Code (3739)
This entry was posted in AS3, Flash and tagged , , , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

23 Comments

  1. Julius
    Posted November 15, 2011 at 7:10 pm | Permalink

    Hi Lex. Great class!

    Was just wondering, how do you make the easing effect to ‘ease in’ instead of ‘ease out’ (default)?
    It’s a bit hard to scroll to the last object when the stage’s width is huge.

    Thanks.

  2. Posted October 9, 2011 at 11:13 am | Permalink

    Steven — this is released under a use-as-is-within-anything-you’d-like license. Feel free to use it within any commercial or personal work you’d like. There are numerous versions of this type of code on the web, so, it’s not a big enough of secret for me to have to license for use.

  3. Özgür
    Posted October 2, 2011 at 5:19 pm | Permalink

    Hi lex. Thanks for the class.

    I have an issue with my project using your class. When I add some moveClip including shape tween all the items disappear in a snap. How can i fix this?

    Thanx

One Trackback

  1. [...] via Simple AS3 Parallax System Engine. [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>