/* Copyright (c) 2008 Yahoo! Inc. All rights reserved. The copyrights embodied in the content of this file are licensed under the BSD (revised) open source license */ package { import flash.display.MovieClip; import flash.events.Event; import fl.controls.NumericStepper; import fl.data.DataProvider; import com.yahoo.astra.fl.controls.TabBar; public class TabBarNumericStepper extends MovieClip { public function TabBarNumericStepper() { var tabData:Array = [ "Tab 1", "Tab 2", "Tab 3" ]; this.tabBar = new TabBar(); this.tabBar.dataProvider = new DataProvider( tabData ); this.tabBar.selectedIndex = 0; this.tabBar.move(10, 10); this.tabBar.addEventListener( Event.CHANGE, tabBarChangeHandler ); this.addChild( this.tabBar ); this.stepper = new NumericStepper(); this.stepper.minimum = -1; this.stepper.maximum = 2; this.stepper.value = 0; this.stepper.stepSize = 1; this.stepper.addEventListener( Event.CHANGE, stepperChangeHandler ); this.stepper.move( 10, 50 ); this.addChild(this.stepper); } private var tabBar:TabBar; private var stepper:NumericStepper; private function tabBarChangeHandler( event:Event ):void { var index:int = ( event.currentTarget as TabBar ).selectedIndex; this.stepper.value = index; } private function stepperChangeHandler( event:Event ):void { var value:int = ( event.currentTarget as NumericStepper ).value; this.tabBar.selectedIndex = value; } } }