# Next and prevFrame

**URL:** <https://forum.kirupa.com/t/next-and-prevframe/267239>\
**Category:** Uncategorized\
**Created:** [July 30, 2008, 12:07am UTC](https://forum.kirupa.com/t/next-and-prevframe/267239 "2008-07-30T00:07:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![muffmadame](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@muffmadame](https://forum.kirupa.com/u/muffmadame)\
**Post date:** [July 30, 2008, 12:07am UTC](https://forum.kirupa.com/t/next-and-prevframe/267239/1 "2008-07-30T00:07:36Z")

</div>

Hi.  
i have this function underneath applied to several buttons:

stop();  
function PopUpCollagestration(event:MouseEvent):void{  
gotoAndStop(event.target.name);  
}  
walephant\_button.addEventListener(MouseEvent.CLICK,PopUpCollagestration);  
leaving\_button.addEventListener(MouseEvent.CLICK,PopUpCollagestration);  
…

now i want to click from one frame to the next or previous frames.  
… a simple nextFrame / prevFrame action.  
so i applied following in a new action layer:

arrow\_right.addEventListener(MouseEvent.MOUSE\_UP,NextFrame);  
function NextFrame(event:MouseEvent){  
nextFrame()  
}  
arrow\_left.addEventListener(MouseEvent.MOUSE\_UP,PrevFrame);  
function PrevFrame(event:MouseEvent){  
prevFrame()  
}

this only works when i beginn with the first frame. But not when i jump to any other frame.

I suppose there is a code that allows my action to run all over my timeline and not only from the first frame…

Does anyone know ?
