# Abbreviated scroll post

**URL:** <https://forum.kirupa.com/t/abbreviated-scroll-post/291380>\
**Category:** Uncategorized\
**Created:** [June 28, 2009, 11:22pm UTC](https://forum.kirupa.com/t/abbreviated-scroll-post/291380 "2009-06-28T23:22:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jallouf](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@jallouf](https://forum.kirupa.com/u/jallouf)\
**Post date:** [June 28, 2009, 11:22pm UTC](https://forum.kirupa.com/t/abbreviated-scroll-post/291380/1 "2009-06-28T23:22:36Z")

</div>

I think my last post was extremely superfluous.

If anybody could lend some advice on constraining movement along the x axis in a simple thumbnail scroll contained within a static movie clip that would be appreciated.

Here is the clunky code [COLOR=Red](stripped down without the extraneous info).

[/COLOR]Thanks again!

cog1\_mc.addEventListener(MouseEvent.MOUSE\_DOWN, onClick);  
cog1\_mc.addEventListener(MouseEvent.MOUSE\_UP, offClick);  
cog1\_mc.addEventListener(MouseEvent.MOUSE\_UP, offLeft);  
cog2\_mc.addEventListener(MouseEvent.MOUSE\_DOWN, onClick2);  
cog2\_mc.addEventListener(MouseEvent.MOUSE\_UP, offClick2);

function onClick(event:MouseEvent):void  
{  
cog1\_mc.addEventListener(MouseEvent.MOUSE\_DOWN, onClick);  
stage.addEventListener(Event.ENTER\_FRAME, flip);  
stage.addEventListener(Event.ENTER\_FRAME, left);  
}

function onClick2(event:MouseEvent):void  
{  
cog2\_mc.addEventListener(MouseEvent.MOUSE\_DOWN, onClick2);  
stage.addEventListener(Event.ENTER\_FRAME, flip2);  
stage.addEventListener(Event.ENTER\_FRAME, right);  
}

function offClick(event:MouseEvent):void  
{  
cog1\_mc.addEventListener(MouseEvent.MOUSE\_UP, offClick);  
stage.removeEventListener(Event.ENTER\_FRAME, flip);  
stage.removeEventListener(Event.ENTER\_FRAME, left)  
}

function offClick2(event:MouseEvent):void  
{  
cog2\_mc.addEventListener(MouseEvent.MOUSE\_UP, offClick2);  
stage.removeEventListener(Event.ENTER\_FRAME, flip2);  
stage.removeEventListener(Event.ENTER\_FRAME, right);  
}

function flip(event:Event):void  
{  
cog1\_mc.rotation -= 12;  
cog2\_mc.rotation -= 12;  
}

function flip2(event:Event):void  
{  
cog2\_mc.rotation += 12;  
cog1\_mc.rotation += 12;  
}

cog1\_mc.buttonMode = true;  
cog2\_mc.buttonMode = true;

function left(event:Event):void  
{  
win.x -= 15;  
}

function right(event:Event):void  
{  
win.x += 15;  
}

function offLeft(event:Event):void  
{  
if (lastX \<= -945.1)  
{  
win.x = -945.1;  
}  
}

function offRight(event:Event):void  
{  
if (lastX \>= 500)  
{  
win.x = 500;  
}  
}
