ActionScript 3.0 Lesson 18: How to Create a Commission Calculator

Sun, Aug 23, 2009

ActionScript


Enter the values below and click calculate

This movie requires Flash Player 9


THE COMMISSION CALCULATOR IS NOW A HIT GADGET PROVIDING ADVERTISEMENT REVENUE CLICK HERE TO SEE!

In this 7 minutes Flash tutorial in High Definition (HD) resolution, Avraham draws a calculator on stage and adds functionality. Great examples on different text types in Flash, Static, Input and Dynamic.

DOWNLOAD THE SOURCE FLA FILE
DOWNLOAD THIS TUTORIAL TO YOUR HARD DRIVE

HERE IS THE SOURCE CODE!

//Comission Calculator
//by AVRAHAM SALTOUN
// solutions at say-web dot com
// FREE TO USE AND DISTRIBUTE

myButton_btn.addEventListener(MouseEvent.CLICK, FindComission);
// This will set the compiler
// waiting for a mouse click
// on our button

function FindComission (event:MouseEvent):void
{
// Let’s find out what is on our screen!
var myAmount:Number = Number(Amount_txt.text);
// This will find out what is on the Amount Box
// and convert it to a value

var myRate:Number= Number(Rate_txt.text)/100;
// Since we are looking for a percentage
// we are dividing the value by 100

var myComission:Number = myAmount* myRate;

// Now let’s put the result
// in the Dynamic Text Box
// The Value has to become a string

Total_txt.text = String(myComission);

//Thanks for Watching!!

Related Articles:

, , , , , , , , , , , , , , , ,

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 49 bytes) in /home/content/23/5413223/html/say-web/wp-settings.php on line 312