how to convert as2 code to as3
===

I am new to as3 can any one change below code into as3, thanks in advance.
Its a game that we need to convert as2 code into as3 version so need urgent help this.
Or you have any online tool that convert those code into as3 please let me know.

    var itemTypes:Number = 7;// How many different types of icons are there?
    var countCols:Number = 11;// Number of items in each column
    var countRows:Number = 11;// Number of items in each row
    var SW:Number = 460;// Play area width (Or use Stage.width;)
    var SH:Number = 460;// Play area height(Or use Stage.height;)
    var colWidth:Number = SW / countCols;// Spacing
    var colHeight:Number = SH / countRows;// Spacing
    var n:Number = 1;
    var score:Number = 0;
    var Xoffset:Number = 100;
    var Yoffset:Number = 100;
    score_txt.text = score;

    startTimer = getTimer();
    startTime = getTicks();

    var firstClick:MovieClip = undefined;
    var doCheck:Boolean = false;
    var doScroll:Boolean = false;
    var animCtr:Number = 0;
    
    var cells:Array = [];
    kRadiansToDegrees = 180 / Math.PI;
    kDegreesToRadians = Math.PI / 180;
    
    // Returns a number in the range minVal to MaxVal, inclusive
    MovieClip.prototype.randomInt = function(minVal, maxVal)
    {
    	return minVal + Math.floor(Math.random() * (maxVal + 1 - minVal));
    	trace(maxVal + 1 - minVal);
    };
    
    isLegal = function(c1,c2) {;
    var dx = c1.myRow - c2.myRow;
    var dy = c1.myCol - c2.myCol;
    if (dx == 0 && Math.abs(dy) == 1);
    return true;
    else if (dy == 0 && Math.abs(dx) == 1);
    return true;
    else;
    return false;
    };
    
    // ---------------------------------------------------------------------------------------------
    //                          Move cells into position to fill up gaps
    // ---------------------------------------------------------------------------------------------
    moveCell = function ()
    {
    	var dx = this.dx - this._x;
    	var dy = this.dy - this._y;
    	if (Math.abs(dx) < .5 && Math.abs(dy) < .5)
    	{
    		this._rotation = 0;
    		this._x = this.dx;
    		this._y = this.dy;
    		doCheck = true;
    		delete this.onEnterFrame;
    		animCtr--;
    	}
    	this._x += dx / 4;
    	this._y += dy / 4;
    };
    // ---------------------------------------------------------------------------------------------
    
    growCell = function ()
    {
    	var dx = this.dxs - this._xscale;
    	var da = this.da - this._alpha;
    	if (Math.abs(da) < .5)
    	{
    		this._xscale = this.dxs;
    		this._yscale = this.dxs;
    		this._alpha = this.da;
    		doScroll = true;
    		delete this.onEnterFrame;
    		animCtr--;
    	}
    	this._xscale += dx / 3;
    	this._yscale += dx / 3;
    	this._alpha += da / 3;
    };
    
    // ---------------------------------------------------------------------------------------------
    //                          Swap the positions of item 1 and item 2
    // ---------------------------------------------------------------------------------------------
    beginSwap = function (c1, c2)
    {
    	var tx = c1.myRow;
    	var ty = c1.myCol;
    	c1.myRow = c2.myRow;
    	c1.myCol = c2.myCol;
    	c1.dx = c1.myCol * colWidth + colWidth / 2;
    	c1.dy = c1.myRow * colHeight + colHeight / 2;
    	c2.myRow = tx;
    	c2.myCol = ty;
    	c2.dx = c2.myCol * colWidth + colWidth / 2;
    	c2.dy = c2.myRow * colHeight + colHeight / 2;
    	c1.onEnterFrame = moveCell;
    	c2.onEnterFrame = moveCell;
    	cells[c1.myRow][c1.myCol] = c1;
    	cells[c2.myRow][c2.myCol] = c2;
    	animCtr += 2;
    };
    
    // ---------------------------------------------------------------------------------------------
    
    clickMe = function() {;
    trace ("I am " + this);
    if (animCtr > 0);
    // Don't allow icons to be clicked whilst playboard is animating matches;
    return; ;
    if (firstClick == undefined) {;
    // This is the first icon to be clicked, so visually mark it and store it's _mc as "firstClick";
    firstClick = this;
    this._rotation = 10;
    } else {;
    if (isLegal(this,firstClick)){;
    this._rotation = -10;
    beginSwap(this,firstClick); // check matches after swap;
    firstClick = undefined;
    } else {;
    firstClick._rotation = 0;
    firstClick = this;
    this._rotation = 10;
    };
    };
    };
    
    isMatch = function (x1, y1, x2, y2, x3, y3)
    {
    	if (x3 >= countCols || y3 > countRows)
    	{
    		return 0;
    	}
    	if (cells[y1][x1].myType == cells[y2][x2].myType && cells[y1][x1].myType == cells[y3][x3].myType)
    	{
    		return 2;
    	}
    	return 0;
    };
    
    // ---------------------------------------------------------------------------------------------
    //                        Flood-fill like function to flag cells of a kind
    // ---------------------------------------------------------------------------------------------
    flagMatchingCells = function (x, y)
    {
    	if (cells[y][x].isFlagged)
    	{
    		return;
    	}
    	score++;
    	score_txt.text = score;
    	cells[y][x].isFlagged = true;
    	cells[y][x].dxs = 300;
    	cells[y][x].da = 0;
    	cells[y][x].onEnterFrame = growCell;
    	animCtr++;
    	if (x > 0 && cells[y][x - 1].myType == cells[y][x].myType)
    	{
    		flagMatchingCells(x - 1,y);
    	}
    	if (x < countCols - 1 && cells[y][x + 1].myType == cells[y][x].myType)
    	{
    		flagMatchingCells(x + 1,y);
    	}
    	if (y > 0 && cells[y - 1][x].myType == cells[y][x].myType)
    	{
    		flagMatchingCells(x,y - 1);
    	}
    	if (y < countRows - 1 && cells[y + 1][x].myType == cells[y][x].myType)
    	{
    		flagMatchingCells(x,y + 1);
    	}
    };
    
    checkMatches = function ()
    {
    	var oldScore = score;
    	// for each cell
    	for (var ey = 0; ey < countRows; ey++)
    	{
    		for (var ex = 0; ex < countCols; ex++)
    		{
    			if (isMatch(ex, ey, ex + 1, ey, ex + 2, ey) || isMatch(ex, ey, ex, ey + 1, ex, ey + 2))
    			{
    				flagMatchingCells(ex,ey);
    				// trace('match ' + x + ', ' + y + ' : ' + m);
    			}
    		}
    	}
    	if (score - oldScore > 3)
    	{
    		startTimer += 500;
    		score += 10 * (score - oldScore + 3);
    		score_txt.text = score;
    	}
    };
    
    checkAnim = function ()
    {
    	// walk thru columns.  from bottom to top
    	for (var ca1 = 0; ca1 < countCols; ca1++)
    	{
    		var cnt = 0;
    		pcells = [];
    		for (var cAy = countRows - 1; cAy >= 0; cAy--)
    		{
    			var mc = cells[cAy][ca1];
    			if (mc.isFlagged)
    			{
    				pcells.push(mc);
    				// clear the flag
    				cnt++;
    			}
    			else if (cnt)
    			{
    				mc.dx = ca1 * colWidth + colWidth / 2;
    				mc.dy = (cAy + cnt) * colHeight + colHeight / 2;
    				mc.myRow = mc.myRow + cnt;
    				mc.onEnterFrame = moveCell;
    				animCtr++;
    				cells[mc.myRow][ca1] = mc;
    			}
    		}
    		var n = 0;
    		for (var i = cnt - 1; i >= 0; --i)
    		{
    			var mc = pcells[i];
    			mc.isFlagged = false;
    			mc._xscale = mc._yscale = 90;
    			mc.dx = ca1 * colWidth + colWidth / 2;
    			mc.dy = n * colHeight + colHeight / 2;
    			mc._y = (n - cnt) * colHeight + colHeight / 2;
    			mc.myRow = n;
    			cells[n][ca1] = mc;
    			mc.onEnterFrame = moveCell;
    			animCtr++;
    			randomiseItemType(mc);
    			n++;
    		}
    	}
    };
    
    // ---------------------------------------------------------------------------------------------
    //                                        Randomise the icon type
    // ---------------------------------------------------------------------------------------------
    randomiseItemType = function (mc)
    {
    	mc.myType = randomInt(1, itemTypes);
    	mc.gotoAndStop(mc.myType);
    	mc._alpha = 100;
    	// mc._xscale = random(2)? -100 : 100; // Sets varying levels icon width, including full -100% (flipped)
    };
    // ---------------------------------------------------------------------------------------------
    
    lead2 = function (n)
    {
    	return String(100 + n).substr(1);
    	// Related to countdown timer
    };
    
    onEnterFrame = function ()
    {
    	if (animCtr == 0)
    	{
    		if (doScroll)
    		{
    			// trace('scroll');
    			checkAnim();
    			doScroll = false;
    		}
    		else if (doCheck)
    		{
    			checkMatches();
    			doCheck = false;
    		}
    	}
    	// --- Countdown timer --- 
    	clock = 60 * 0.2 - Math.floor((getTimer() - startTimer) / 1000);
    	clock_txt.text = Math.floor(clock / 60) + ':' + lead2(clock % 60);
    	if (clock <= 0)
    	{
    		// Delete all movieclips and go to GameOver.
    		for (var rm1 = 0; rm1 < countRows; rm1++)
    		{
    			for (var rm2 = 0; rm2 < countCols; rm2++)
    			{
    				cells[rm1][rm2].removeMovieClip();
    			}
    		}
    		delete this.onEnterFrame;
    		gotoAndStop(2);
    		// Game Over
    	}
    	// ------------------------ 
    };
    
    // ---------------------------------------------------------------------------------------------
    //                                       Initialisation
    // ---------------------------------------------------------------------------------------------
    for (var inity:Number = 0; inity < countRows; inity++)
    {
    cells[inity] = [];
    for (var initx:Number = 0; initx < countCols; initx++)
    {
    // var mc = _root.createEmptyMovieClip('tile_'+n, n);
    var mc = _root.gamearea.attachMovie('ball_mc', 'tile_' + n, n);
    mc._x = initx * colWidth + colWidth / 2;
    mc._y = inity * colHeight + colHeight / 2;
    mc._xscale = mc._yscale = 100;
    mc.myRow = inity;
    mc.myCol = initx;
    mc.onRollOver = function():Void 
    {
    this._xscale = 110;//(this._xscale < 0)? -110 : 110;
    this._yscale = 110;
    };
    mc.onRollOut = function():Void 
    {
    this._xscale = 100;//(this._xscale < 0)? -100 : 100;
    this._yscale = 100;
    };
    n++;
    mc.onRelease = clickMe;
    cells[inity][initx] = mc;
    randomiseItemType(mc);
    }
    }
    
    checkMatches();
    
    stop();