Thanks to a comment posted by doggy, I’ve updated the FishEyeMenu class to listen for MouseDown events and keep track of selected items.
- public function get selected():*
- public function get lastSelected():*
- public function set selected( clickedItemEvent:MouseEvent ):void
New Event Type
- FishEyeMenu.SELECTED_CHANGED – Triggered upon a change in selected menu item
Once you’ve pushed an item into the FishEyeMenu object, it keeps track of it’s own MouseDown events on the items in it’s array. When a user clicks on a menu item, it sets the _lastSelected property to whatever Was selected, and sets the _currentSelected property to whatever menu item was clicked.
You can now add an event listener for SELECTED_CHANGED which will dispatch upon MouseDown on a menu item.
Please note, the getters for selected and lastSelected are going to return the actual Object that you pushed to the menu. So it will return a reference to the actual TextField or MovieClip or Sprite or whatever you’re using in the menu. If you check the Example FLA, you’ll see this code as an example
// in the main function
fishEyeMenu.addEventListener( FishEyeMenu.SELECTED_CHANGED , changedHandler );
//later in the code:
* Simple test of usage, fishEyeMenu.selected returns the object selected
* so it's just like calling the actual object that was clicked last and
* you can set whatever properties that object has.
* If this were a MovieClip, you could use fishEyeMenu.selected.gotoAndStop()
private function changedHandler( e:* )
trace( "Selected Item Changed to : " + fishEyeMenu.selected.name );
trace( "Selected Item Changed to : " + fishEyeMenu.lastSelected.name );
In the simple example, calling fishEyeMenu.selected.x += 20; just moves the object you clicked over 20 pixels to the right (+20). But you could also use fishEyeMenu.selected.gotoAndStop( “Selected” ); if you had pushed several Movie Clips into FishEyeMenu… and they had a frame with framelabel “Selected”. Post comments if you’d like… it only helps make things better.
Download FishEyeMenu v1.1 from GoogleCode
View Updated Documentation