# How can I convert AS2 to AS3

**URL:** <https://forum.kirupa.com/t/how-can-i-convert-as2-to-as3/331828>\
**Category:** flash\
**Created:** [November 2, 2013, 5:43pm UTC](https://forum.kirupa.com/t/how-can-i-convert-as2-to-as3/331828 "2013-11-02T17:43:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashadweb](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@ashadweb](https://forum.kirupa.com/u/ashadweb)\
**Post date:** [November 2, 2013, 5:43pm UTC](https://forum.kirupa.com/t/how-can-i-convert-as2-to-as3/331828/1 "2013-11-02T17:43:21Z")

</div>

Hi I want to convert the below code to AS2 currently it is AS3

```auto
// Set variables for numbers we need in our equationsvar activatorWidth:int = activator.width;
var activatorHeight:int = activator.height;
var boundX:int = bigPic.x + activator.x * 2;
var boundY:int = bigPic.y + activator.y * 2;
var diffX:int = bigPic.width - activatorWidth;
var diffY:int = bigPic.height - activatorHeight;
var easeSpeed:int = 7;

// Function that activates the movement (MOUSE_OVER activator)
function activate(event:Event):void {
	var divX:Number = mouseX / activatorWidth;
	var divY:Number = mouseY / activatorHeight;
	var moveX:Number = divX * diffX;
	var moveY:Number = divY * diffY;
	bigPic.x += (boundX - moveX - bigPic.x) / easeSpeed;
	bigPic.y += (boundY - moveY - bigPic.y) / easeSpeed;
}
// Listeners on the activator to Add / Remove Enter Frame Events
activator.addEventListener(MouseEvent.MOUSE_OVER, addEnterFrameEvent);
activator.addEventListener(MouseEvent.MOUSE_OUT, removeEnterFrameEvent);
// Add Enter Frame Event Function
function addEnterFrameEvent (event:MouseEvent):void {
	addEventListener(Event.ENTER_FRAME, activate);
}
// Remove Enter Frame Event Function
function removeEnterFrameEvent (event:MouseEvent):void {
	removeEventListener(Event.ENTER_FRAME, activate);
}

```
