# Moving through frames with mouse\_down and drag

**URL:** <https://forum.kirupa.com/t/moving-through-frames-with-mouse-down-and-drag/330559>\
**Category:** flash\
**Created:** [February 8, 2013, 9:07pm UTC](https://forum.kirupa.com/t/moving-through-frames-with-mouse-down-and-drag/330559 "2013-02-08T21:07:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lio89](https://avatars.discourse-cdn.com/v4/letter/l/74df32/32.png) [@lio89](https://forum.kirupa.com/u/lio89)\
**Post date:** [February 8, 2013, 9:07pm UTC](https://forum.kirupa.com/t/moving-through-frames-with-mouse-down-and-drag/330559/1 "2013-02-08T21:07:20Z")

</div>

Hi. I have an image sequence that shows a product 360º.  
I have it imported into flash.  
What I’m trying to achieve, is to be able to move through frames depending on if I move to left or to right using mouse\_down, instead of prevFrame and nextFrame.

Is it very hard to do?  
Can this code be reused?

Sorry about my english. Thanks!

```auto
import flash.events.MouseEvent;
import flash.events.Event;
mc1.addEventListener(MouseEvent.MOUSE_DOWN,downf);
mc1.addEventListener(MouseEvent.MOUSE_UP,upf);

addEventListener(Event.ENTER_FRAME, update);
var dragging:Boolean;
var offSetX:int;
var offSetY:int;

function downf(e:MouseEvent)
{
dragging = true;
offSetX = mouseX - mc1.x;
offSetY = mouseY - mc1.y;
}

function upf(e:MouseEvent)
{
dragging = false;
}

function update(e:Event)
{
if(dragging)
{
mc1.x = mouseX - offSetX;
mc1.y = mouseY - offSetY;
}
}

```
