Flex: Number input with buttons -
i'm trying use buttons text input, far can make input 1 number. (if click button second input, erases first input.) there way fix this?
i added code here , image show i'm trying make.
i'd appreciate help!
<mx:button x="18" y="116" label="1" width="20" height="20" fontsize="7" click="one(event)"/> <mx:button x="37" y="116" label="2" width="20" height="20" fontsize="7" click="two(event)"/> <mx:button x="56" y="116" label="3" width="20" height="20" fontsize="7" click="three(event)"/> <mx:button x="18" y="135" label="4" width="20" height="20" fontsize="7" click="four(event)"/> <mx:button x="37" y="135" label="5" width="20" height="20" fontsize="7" click="five(event)"/> <mx:button x="56" y="135" label="6" width="20" height="20" fontsize="7" click="six(event)"/> <mx:button x="18" y="154" label="7" width="20" height="20" fontsize="7" click="seven(event)"/> <mx:button x="37" y="154" label="8" width="20" height="20" fontsize="7" click="eight(event)"/> <mx:button x="56" y="154" label="9" width="20" height="20" fontsize="7" click="nine(event)"/> <mx:button x="18" y="173" label="x" width="20" height="20" fontsize="7" click="erase(event)"/> <mx:button x="37" y="173" label="0" width="20" height="20" fontsize="7" click="zero(event)"/> <mx:button x="56" y="173" width="20" height="20" label="ent" fontsize="7" click="ent(event)"/> public function one(event:mouseevent):void { numbercopies.text = "1"; } public function two(event:mouseevent):void { numbercopies.text = "2"; }
...
<?xml version="1.0" encoding="utf-8"?> <s:application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" > <fx:script> <![cdata[ [bindable] public var copies:string = ""; public function one(event:mouseevent):void { copies += "1"; } public function two(event:mouseevent):void { copies += "2"; } ]]> </fx:script> <s:label id="numbercopies" text="{copies}"/> <mx:button x="18" y="116" label="1" width="20" height="20" fontsize="7" click="one(event)"/> <mx:button x="37" y="116" label="2" width="20" height="20" fontsize="7" click="two(event)"/> </s:application>
Comments
Post a Comment