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)
23 Comments
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.
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.
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
[...] via Simple AS3 Parallax System Engine. [...]