# Scrolling Thumbnails - So close to working!

**URL:** <https://forum.kirupa.com/t/scrolling-thumbnails-so-close-to-working/322082>\
**Category:** Uncategorized\
**Created:** [May 10, 2011, 11:23am UTC](https://forum.kirupa.com/t/scrolling-thumbnails-so-close-to-working/322082 "2011-05-10T11:23:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ttmt](https://avatars.discourse-cdn.com/v4/letter/t/9fc29f/32.png) [@ttmt](https://forum.kirupa.com/u/ttmt)\
**Post date:** [May 10, 2011, 11:23am UTC](https://forum.kirupa.com/t/scrolling-thumbnails-so-close-to-working/322082/1 "2011-05-10T11:23:06Z")

</div>

Scrolling Thumbnails - So close to working !!!

I have been using the code here to try and create scrolling thumbnails on MOUSEOVER.

> **[Parallax Scrolling](http://as3adventure.blogspot.com/2010/05/parallax-scrolling.html)**
>
> Code snippet for parallax scrolling .

This example scrolls the whole of the MovieClip but I wanted to scroll just the Thumbnails inside a mask

The demo I have [HERE](http://www.ttmt.org.uk/forum/scroll/) is just a MovieClip of images - images.  
The images then has a Sprite on top and this Sprite masks the thumbnails below  
When I MOUSEOVER the thumbnails I want them to scroll to show the hidden thumbnails

It’s nearly woking but I can’t get it to work correctly. When scrolling to the right I want it to stop  
when the last image is shown. Also the first images are hidden.

Any help of this would be greatly appreciated.

[http://www.ttmt.org.uk/forum/scroll/](http://www.ttmt.org.uk/forum/scroll/)

```auto

package{
	
	import flash.events.*
	import flash.display.*
	
	public class Doc extends MovieClip{
		
		private var images:MovieClip = new Img();
		private var maskObj:Sprite = new Sprite();
		
		public function Doc(){
			maskObj.graphics.beginFill(0x00ffff);
			maskObj.graphics.drawRect(0,0,800,100);
			maskObj.graphics.endFill();
			addChild(maskObj)
			maskObj.x = maskObj.y = 100;
			//
			addChild(images);
			images.x = images.y = maskObj.y;
			//
			images.mask = maskObj;
			//
			thumbsCanScroll()
		}
		
		private function thumbsCanScroll():void{
			images.addEventListener(MouseEvent.MOUSE_OVER, imagesMOUSEOVER);
			images.addEventListener(MouseEvent.MOUSE_OUT, imagesMOUSEOUT);
		} 
		
		private function imagesMOUSEOVER(e:MouseEvent):void{
			images.addEventListener(Event.ENTER_FRAME, scrollThumbs);
		}
		
		private function imagesMOUSEOUT(e:MouseEvent):void{
			images.removeEventListener(Event.ENTER_FRAME, scrollThumbs);
		}
		
		private function scrollThumbs(e:Event):void{
			var xDist:Number = (mouseX - images.x)/maskObj.width;
			images.x = -xDist*(images.width - maskObj.width);
		}
	}
}

```
