1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
package itemEditor
{
import mx.collections.ArrayCollection;
import mx.containers.VBox;
import mx.controls.Alert;
import mx.events.FlexEvent;
import spark.components.TextInput;
import spark.events.TextOperationEvent;
import spark.layouts.HorizontalAlign;
import spark.layouts.VerticalAlign;
public class AccuEditor extends VBox
{
[Bindable] public var retour:String;
private var _data:Object;
private var textInput:TextInput;
[Bindable]
override public function set data(value:Object):void{
_data = value;
draw();
}
override public function get data():Object{
return _data;
}
private function draw():void
{
removeAllElements();
setStyle("horizontalAlign", HorizontalAlign.CENTER);
setStyle("verticalAlign", VerticalAlign.MIDDLE);
textInput = new TextInput();
textInput.percentWidth = 90;
textInput.text = data.accu_totale;
textInput.restrict = "0-9";
textInput.addEventListener(FlexEvent.UPDATE_COMPLETE, changeText);
addElement(textInput);
textInput.setFocus();
}
private function changeText(event:FlexEvent):void
{
data.accu_totale = TextInput(event.currentTarget).text;
retour = data.accu_totale;
}
}
} |
Partager