Title says what I am wondering… I am still messing around with making text clickable, this is what I have.
Variables:
private var selectText:Text = new Text("Option One");
private var clickMe:Entity;
In my world begin()
clickMe = addGraphic(selectText);
clickMe.setHitbox(selectText.textWidth, selectText.textHeight);
In my world update()
if (collidePoint(selectText.x, selectText.y, this.mouseX, this.mouseY))
{
if (Input.mouseReleased)click();
}
super.update();
My click()
public function click():void
{
trace("clicking");
}
I keep getting all sorts of errors from the collidePoint function which is telling me it only is expecting three parameters which I know is not correct… also I have tried passing it clickMe.x and clickMe.y but that doesn’t work because I am setting it equal to a string?
I am lost any help would be great! If I take out the update method the text appears with a hitbox around it, I am just trying to make it actually do something when I click the hitbox! Thanks guys!