# prevFrame() with mouse collision detection

**URL:** <https://forum.kirupa.com/t/prevframe-with-mouse-collision-detection/236614>\
**Category:** flash\
**Created:** [August 22, 2007, 8:05am UTC](https://forum.kirupa.com/t/prevframe-with-mouse-collision-detection/236614 "2007-08-22T08:05:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![keymistress](https://avatars.discourse-cdn.com/v4/letter/k/a8b319/32.png) [@keymistress](https://forum.kirupa.com/u/keymistress)\
**Post date:** [August 22, 2007, 8:05am UTC](https://forum.kirupa.com/t/prevframe-with-mouse-collision-detection/236614/1 "2007-08-22T08:05:27Z")

</div>

hello all,

i have successfully created scripts with prevFrame() that work, thanks to Kirupa’s tutorials. however, when i try to use “mouse collision detection” with prevFrame(), it will not work. ☹

i added a mouselistener object to detect if my mouse hits the purplebar i have on stage:

```auto
this.onEnterFrame = function() {
    if (rewind == true) {
        //if rewind switch is set to true play backwards
        prevFrame();
        // play backwards
    }
};
// create a mouse listener object.
var mouseListener:Object = new Object();
/* every time the mouse cursor moves within the SWF file, 
   update the position of the crosshair movie clip instance on the Stage. */
mouseListener.onMouseMove = function() {
    if (purplebar.hitTest(_xmouse, _ymouse, false)) {
        rewind = false;
        play();
    } else {
        rewind = true;
    }
};
Mouse.addListener(mouseListener);

```

i’ve tried putting trace in my function to test my mouse detection is working and all. help please?!

_I’ve uploaded the .fla file. Will appreciate if you can take a look at it. Thanks in advance!_
