# Quick AS code question

**URL:** <https://forum.kirupa.com/t/quick-as-code-question/243347>\
**Category:** programming\
**Created:** [November 6, 2007, 12:24am UTC](https://forum.kirupa.com/t/quick-as-code-question/243347 "2007-11-06T00:24:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jose3760](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jose3760/32/2887_2.png) [@jose3760](https://forum.kirupa.com/u/jose3760)\
**Post date:** [November 6, 2007, 12:24am UTC](https://forum.kirupa.com/t/quick-as-code-question/243347/1 "2007-11-06T00:24:39Z")

</div>

How come this code:

> 

onClipEvent (load) {  
var speed = 2  
}  
onClipEvent (enterFrame) {  
dx = this.\_x - \_root[“minion”].\_x  
dy = this.\_y - \_root[“minion”].\_y  
radians = Math.atan2(dy,dx)  
degrees = Math.round(radians\*180/Math.PI)  
if (this.\_rotation \< degrees - 90) {  
this.\_rotation += speed  
}  
if (this.\_rotation \> degrees - 90) {  
this.\_rotation -= speed  
}  
}

will NOT work when im using flash 2004, but when i save it as macromedia flash mx compatible (so i can view it on our crappy school computers) the code works??  
is the code only appliable for AS and not AS2?  
if so, what do I need to change on the code to make it work for AS2?  
(this code is on a rotating turret that looks at enemies)
