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;
}
}