actionscript 3 - as3 How can i change a number with two button -
i need alter number (dynamic text) 2 button, - , +. if press + (plus) on dynamic text must add together 1 , on.
for ex:
text = on (release) { text =i+1; }
fyi, code in actionscript 2, should larn actionscript 3.
anyway, first create 2 buttons
, 1 dynamic textfield
. name them btn_minus
, btn_plus
, tf
, write 0 in textfield
.
and seek this:
import flash.events.mouseevent; btn_minus.addeventlistener(mouseevent.click, onminus); btn_plus.addeventlistener(mouseevent.click, onplus); var count:int = 0; function onminus(e:mouseevent):void { count --; tf.text = string(count); } function onplus(e:mouseevent):void { count ++; tf.text = string(count); }
actionscript-3 flash air
No comments:
Post a Comment