I am trying to set up a function that makes the hit areas for buttons. The text is visible, but the hit area rectangle underneath the text is not, but detects the hit; my previous version, the mouse had to be over the actual descenders and ascenders of text to register, to the rectangle makes it easier to click. I have the invisible part of the hit areas visible right now, by commenting out the line to make them invisible, but the end result will have them invisible. Instead of explicitly defining every rectangle, I am successfully passing the x,y,height, and width params to newbut function. But I also want to pass the names for each button, otherwise it seems to just change the coordinates on the same button. I am trying to pass the names as strings, but not working. Not sure what to do!!! PS this is my first time on this or any other Flash board, so please be gentle.
var abouthit:Sprite=new Sprite ;
var ratehit:Sprite=new Sprite ;
var refhit:Sprite=new Sprite ;
var homehit:Sprite=new Sprite ;
var servhit:Sprite=new Sprite ;
var skillhit:Sprite=new Sprite ;
function makebut(newx:Number,newy:Number,w:Number,h:Number,newname) {
newname = new Sprite();
addChild(newname);
homehit.graphics.lineStyle(3,0x00ff00);
homehit.graphics.beginFill(0xFFFFFF);
homehit.graphics.drawRect(newx,newy,w,h);
homehit.graphics.endFill();
trace(newname);
//homehit.visible = false;
}
makebut(30,137,70,57,“homehit”);
makebut(135,137,190,57,“abouthit”);
makebut(350,137,190,57,“ratehit”);
makebut(580,137,235,57,“refhit”);
makebut(880,137,235,57,“servhit”);
makebut(1130,137,140,57,“skillhit”);