Step-1: Create 3 input fields and name them n1, n2, r1, respectively in the
properties panel.
Step-2: Create 5 buttons with the texts on them “add”, “sub”, “mul”, “div”
“div”, “mod” respectively.
Step-3: Select the “add” button and open the action panel and write the
following code in the script pane.
on (press) {
var a:Number;
var b:Number;
a=Number(n1.text);
b=Number(n2.text);
r1.text=a+b;
}
Step-4: Select the “sub” button and open the action panel and write the
following code in the script pane.
on (press)
{
var a:Number;
var b:Number;
a=Number(n1.text);
b=Number(n2.text);
r1.text=a-b;
}
Step-5: Select the “mul” button and open the action panel and write the
following code in the script pane.
on (press)
{
var a:Number;
var b:Number;
a=Number(n1.text);
b=Number(n2.text);
r1.text=a*b;
}
Step-6: Select the “div” button and open the action panel and write the
following code in the script pane.
on (press)
{
var a:Number;
var b:Number;
a=Number(n1.text);
b=Number(n2.text);
r1.text=a/b;
}
Step-7: Select the “mod” button and open the action panel and write the
following code in the script pane.
on (press)
{
var a:Number;
var b:Number;
a=Number(n1.text);
b=Number(n2.text);
r1.text=a%b;
}
Step-8: press ctrl+enter to test the movie and enter any two numbers in the
n1 and n2 fields and click any button and the particular operation
will be performed and the result will be displayed in the r1 field