Hi there, i am trying to make a rollOver effect using class
package
{
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class MainBtn extends MovieClip
{
public function MainBtn()
{
this.buttonMode = true;
this.tbtnName.text = this.name;
this.tbtnName.autoSize = TextFieldAutoSize.LEFT;
//
//this.MainBtn_bg.width = this.tbtnName.width+8;
//
this.addEventListener(MouseEvent.ROLL_OVER, btnRollOver);
this.addEventListener(MouseEvent.ROLL_OUT, btnRollOut);
}
function btnRollOver(event:MouseEvent):void
{
trace("rollOver");
event.target.gotoAndPlay(2);
}
function btnRollOut(event:MouseEvent):void
{
trace("rollOut");
event.target.gotoAndPlay(11);
}
}
}
when i comment this part
this.MainBtn_bg.width = this.tbtnName.width+8;
then it works fine. Else it resizes the button but doesnt not have the rollOver effect. Please help.