Quick AS code question

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)