Hey guys! I have a pretty simple question I think… I haven’t really done much work with UI’s or anything like that but I am currently creating an array of empty inventory slots and displaying them to the screen. I want the slots to be clickable and deliver a trace message for now.
I have it working if my player does not cause the screen to scroll… But as soon as I move, the trace messages stop working upon clicking. I am assuming I am not scrolling something I should be.
Here is the world class where I create the array:
for (var i:int = 0; i < 9; i ++)
{
imageArray.push(new Inventory(200 + 32 * i, 448));
add(imageArray[i]);
}
Here is the inventory slot class where I have the mouse interaction:
override public function update():void
{
if (collidePoint(x, y, world.mouseX, world.mouseY))
{
if (Input.mouseReleased) click();
}
}
public function click():void
{
trace("clicking and empty inventory slot");
}
This works until I move the player and I guess the clickable area does not move with the rest of the game. The interesting part is the actual inventory images move with the game, just the ability to click them disappears as soon as I move D:
Any thoughts guys? I am sure this is a very obvious fix.
Thanks!