Flash actionscript 3.0: how to do addition in flash using class file

how to do addition in flash using class file

Posted by Sankar.G | Posted in | Posted on 12:19 PM

add this code in flash class script file and save this file as checking.as
class checking
{
var mc:MovieClip;
var t1:TextField;
var t2:TextField;
var re:TextField;
public function main(mc,t1,t2,re)
{
mc.onPress=function()
{
var a:Number;
var b:Number;
var c:Number;
a=parseInt(t1.text);
b=parseInt(t2.text);
c=a+b;
re.text=c;
}
}
}
In stage create a 3 text box 2-input text box name(text1 & text2) & 1 - dynamic text box name(res) and create a button name(ball3)and write this code in a frame

code:

var ch:checking=new checking();
ch.main(ball3,text1,text2,res);

and save it as checking.fla

Comments (0)