Container Panner

03.15.2010

In Flex, the ability to scroll a container is commonplace. The ability to pan a container is not. By panning a container, I mean clicking down and dragging the content area, effectively scrolling the container.

I present the container panner. It’s a single class. Instantiate it and set the container property. That’s it. If you want, you can toggle the panning functionality and set custom cursors. Right-click to view the source. Go make something crazy.

Get Adobe Flash player

Tags: , , , ,


Comments

07.20.2010 / Brian Bishop said:

Very nice. Good the way you can still drag/pan when the mouse moves off the canvas

06.01.2011 / Larry G said:

Great stuff. Any easy way to allow mouse events to reach the contents of the container? For example, allow a Text control that has a Mouse_over evenListener to be a child of the container or a button. Thanks …

06.01.2011 / Aaron Hardy said:

@Larry Not off the top of my head. It’s using a transparent sprite that overlays everything in the container so events don’t hit the child elements. Technically you could watch for mouse_over events on the container and semi-manually determine if the mouse is over the child element you’re concerned with, but you can’t watch for mouse_over on the child element itself.


Leave a Comment

Your email address is required but will not be published.




Comment