# Going to a frame based on the current time

**URL:** <https://forum.kirupa.com/t/going-to-a-frame-based-on-the-current-time/316370>\
**Category:** flash\
**Created:** [November 19, 2010, 3:48pm UTC](https://forum.kirupa.com/t/going-to-a-frame-based-on-the-current-time/316370 "2010-11-19T15:48:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![m\_eagleton](https://avatars.discourse-cdn.com/v4/letter/m/c37758/32.png) [@m\_eagleton](https://forum.kirupa.com/u/m_eagleton)\
**Post date:** [November 19, 2010, 3:48pm UTC](https://forum.kirupa.com/t/going-to-a-frame-based-on-the-current-time/316370/1 "2010-11-19T15:48:32Z")

</div>

Hi I have a flash file of a snowman doing various activities.  
He’s doing 7 different things (all individual movie clips) and I place each of the movie clips on the first 7 frames, I placed a stop action on each one.

Here is the code I used

var myDate = new Date();  
var localHours = this.myDate.getHours();  
if (this.localHours\>=6 || this.localHours\<=18)  
{  
gotoAndPlay(1);  
}  
if (this.localHours\>=19 || this.localHours\<=5)  
{  
gotoAndPlay(10);

However no matter what gotoAndPlay frame number I used, it always went to the second frame. Can anybody tell me why?

thanks in advance
