Let’s say I have a small button on stage with some roll over and roll out events. Now I would like to increase button’s hit area so it’s easier to hit. Make a button on stage, convert it to movieclip and name it button, also set instance name to button.

Now add following code:


var square:Sprite = new Sprite();//define an object that will define hit area
square.graphics.beginFill(0xCCFF00);//set it's color
square.graphics.drawRect(button.x, button.y, button.width + 100, button.height + 100);
this.addChild(square);//adding it to stage
square.visible = false;//making hit area invisible
button.hitArea = square;//set that hit area for button is actually a square that we just drew

I commented easier parts of code. The most important line will be described here. When we draw hit area we can define four properties. Coordinates of square (in our case we set them to same position as initial button). Then we define size of hit area. In our case we increased hit rate for 100 pixels in both directions. Following example shows how hit area is increased:

We are done with setting hit area for our button. Now we can add some code to make movieclip act like a button:

button.buttonMode = true;//making movie clip behave as button
button.useHandCursor = true;//making a hand cursor over movie clip
button.mouseChildren = false;

Now we need to add events for roll over and roll out.
Roll over function:

button.addEventListener(MouseEvent.ROLL_OVER, onRollOverF);function onRollOverF(evt:MouseEvent){

var colorTransform:ColorTransform = evt.target.transform.colorTransform;//setting color of button
colorTransform.color = 0xFFFFFF;
evt.target.transform.colorTransform = colorTransform;
}

Roll out function:


button.addEventListener(MouseEvent.ROLL_OUT, onRollOutF);function onRollOutF(evt:MouseEvent){

var colorTransform:ColorTransform = evt.target.transform.colorTransform;//setting color of button
colorTransform.color = 0x333333;
evt.target.transform.colorTransform = colorTransform;
}

And we're done.
Thank your for reading this tutorial.