The best way to control this situation is to use individual buttons (which can be made to act like a ToggleButtonBar using skins), and in the click event handlers check if changes have been made, and then prompt before moving to the next screen.
Is there no way to catch the change in a buttonbar and stop it?
I saved the old index of ToggleButtonBar and ViewStack,and I will reset this index to ToggleButtonBar and ViewStack before alert the message.
protected function onToggleButtonBar_ItemClick(event : ItemClickEvent) : void
ToggleButtonBar.selectedIndex = _oldIndex;
ViewStack.selectedIndex = _oldIndex;
Alert.show(message, title, Alert.YES | Alert.NO, null, callback);