# \[AS2\] How do I rotate a movie clip based on time?

**URL:** <https://forum.kirupa.com/t/as2-how-do-i-rotate-a-movie-clip-based-on-time/304675>\
**Category:** flash\
**Created:** [February 11, 2010, 5:34pm UTC](https://forum.kirupa.com/t/as2-how-do-i-rotate-a-movie-clip-based-on-time/304675 "2010-02-11T17:34:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![himynameiscat](https://avatars.discourse-cdn.com/v4/letter/h/b5e925/32.png) [@himynameiscat](https://forum.kirupa.com/u/himynameiscat)\
**Post date:** [February 11, 2010, 5:34pm UTC](https://forum.kirupa.com/t/as2-how-do-i-rotate-a-movie-clip-based-on-time/304675/1 "2010-02-11T17:34:02Z")

</div>

Basically what I’m trying to do is make a sundial-style clock animation. I’m using AS2 in Flash CS4. I’m still quite new to Flash so my AS know-how is slightly limited…

I want to get the time from the user’s computer (I’m using getHours) and make a line (movie clip) rotate to a certain angle based on the hour. Eg. 1pm = 13 degrees, 2pm = 26 degrees and so on. This is the script I have so far and all it seems to do is rotate the movie clip to 90 degrees. Any help would be greatly appreciated!

```auto
this.onEnterFrame = function () {
    cTime = new Date () ;
    hour = cTime.getHours () ;
        if (hour = 12);
            shadow_mc._rotation = 0;
        
        if (hour = 13);
            shadow_mc._rotation = 13;
        
        if (hour = 14) ;
            shadow_mc._rotation = 26;
        
        if (hour = 15) ;
            shadow_mc._rotation = 40;
        
        if (hour = 16) ;
            shadow_mc._rotation = 56;
        
        if (hour = 17);
            shadow_mc._rotation = 72;
        
        if (hour = 18);
            shadow_mc._rotation = 90;
        
}

```
