Incorporating random func with a Time class: Help?

Well, I’m in the drudgingly slow process of creating a game as so many of us are here on this forum, and as luck would have it I’ve ran into a notorious snag in my programming.

Alright, in my game I was trying to have an enemy character randomly decide upon one of a set of actions that could be possible to inact given the ActionScript 3 random function. And that works all well and good but it only does it once when the game is started. So, my friend said there was a Timer Class which gives the programmer the ability to run any set of code over the time period of the interaction. So, I thought I’d have this time class run this random function every second that the game is being played and therefore the enemy fighter would continuously inact a random action while its not destroyed, of course.

Welp, if there is a better way to accomplish what I’m trying them I’m all ears, but below is presently the code that I have for the Time Class with the random function incorporated in it as well as the output including errors. I just can’t get the darn thing to work! Thanks again for suggestions.

CODE:

package
{

import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.display.Sprite;

public var n:Number;
public var i:Number;
public var randomNum:Number;

public class TimerExample extends MovieClip 
{
	
	
	
    public function TimerExample() 
	{
        var myTimer:Timer = new Timer(1000);
        myTimer.addEventListener("timer", timerHandler);
        myTimer.start();
    }

    public function timerHandler(event:TimerEvent):void 
	{
		randRangeGen(1, 12);
		
		for (i = 0; i < 1; i++) 
		{
		n = randRangeGen(1, 12);
		trace(n);
		}
	}
		
	public function randRangeGen(min:Number, max:Number):Number 
	{
		randomNum = Math.floor(Math.random() * (max - min + 1)) + min;
		return randomNum;
		//trace("Working?" + randomNum);
		
				
	}
	
	/*public function randRange(event:Event):void
	{
		for (i = 0; i < 1; i++) 
		{
		n = randRangeGen(1, 12);
		trace(n);
		}
	}*/
	
		
		    	//trace("timerHandler: " + event);
}

}

///////////////////////////////////////////////////////////////////////////////////////////////////////

OUTPUT: 1180: Call to a possibly undefined method addFrameScript Source: package