Step-1: Select the action script file while opening the flash.
Step-2: Write the following code in the script pane.
class Mathss
{
var a:Number;
var b:Number;
var c:Number;
public function addition(m,n):Number
{
a=m;
b=n;
c=a+b;
return c;
}
}
Step-3: Save the above file as Mathss.as
Step-4: Select the flash document while opening the flash.
Step-5: Create 3 input boxes(texts) and name them as n1, n2, r1.
Step-6: Create a button with the text on it as “ADD” on it.
Step-7: Select the button “add” and open the script pane and write the
following code.
on (release)
{
var ob:Mathss=new Mathss();
r1.text=ob.addition(Number(n1.text),Number(n2.text));
}
Note: 1) Flash document should be saved with the same name
“Mathss.fla”
2) Class name and action script file name should be same.
3) Both action script (.as) file and flash document (.fla) should be
in the same folder.