Events can be fake.
I'm currently creating an app where I make a TileList scroll when the cursor is over it and far enough to either side. I found that if the cursor is left in place while the TileList moved underneath it, the itemRollOver event wasn't getting fired so the rollover highlighting of the TileList items wasn't working. It only works if the cursor itself is moving.
Alex Harui pointed me in the direction of faking an event. It took me a little while to figure out exactly which event on which object to have trigger it (i.e. I kept trying it on the itemRenderer itself.) In the end, the solution was simple.
On the TileList I jsut captured mouseOver:
mouseOver="{itemRolledOver(event)}"
Then created this method:
private function itemRolledOver(event : MouseEvent) : void
{
var mouseOverEvent:MouseEvent = new MouseEvent(MouseEvent.MOUSE_MOVE, true, false, event.localX, event.localY);
event.target.dispatchEvent(mouseOverEvent);
}
... and voila! My rollover highlighting was back!
Save This Page