Skip to content

Instantly share code, notes, and snippets.

@brindy
Created March 17, 2010 16:04
Show Gist options
  • Save brindy/335387 to your computer and use it in GitHub Desktop.
Save brindy/335387 to your computer and use it in GitHub Desktop.
<mx:Script>
<![CDATA[
import mx.controls.Button;
import models.UndoRedoModel;
[Inject][Bindable]
public var urModel:UndoRedoModel;
private function toggleButton(bar:ButtonBar, index:int, enabled:Boolean) : void {
Button(bar.getChildAt(index)).enabled = enabled;
}
]]>
</mx:Script>
<mx:ButtonBar id="urBar">
<mx:dataProvider>
<mx:Object toolTip="Undo" icon="@Embed('assets/images/command_undo.png')" update="{toggleButton(urBar, 0, urModel.canUndo)}" />
<mx:Object toolTip="Redo" icon="@Embed('assets/images/command_redo.png')" update="{toggleButton(urBar, 1, urModel.canRedo)}" />
</mx:dataProvider>
</mx:ButtonBar>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment