Start the Flash program. Click "Flash File(ActionScript 3.0)" from the splash window to create a new file for the AS3 Flash.
Select "Actions" from the "Window" menu on the main Flash menu bar to open the ActionScript 3 editor. Position your mouse cursor on the first line of the ActionScript 3 editor. Click your mouse button, and type in the code below to declare the variables that will store the currency conversion factors.
var United_States_to_Canadian: number = 0.66;
Type, starting at the next line of the ActionScript 3 editor, the code to create two TextFields: one text field that will be used to enter in the United States dollar amount and the other text field to display the equivalent amount in Canadian dollars.
var UnitedStates_Currency:TextField = new TextField();
var Canadian_Currency:TextField = new TextField();
Type, starting at the next line of the ActionScript 3 editor, the code that will convert the number entered into the United States text field to a number from text. (All text entered in a text field is text. Text from text fields needs to operated on as a number must be converted to a number with the number method.)
var A: number
A = number(UnitedStates_Currency);
Type, starting at the next line of the ActionScript 3 editor, the code that will create the function that will perform the conversion of United States currency to Canadian currency.
function convert_fn(event:KeyboardEvent);number
{
if (event.keyCode == Keyboard.ENTER)
{
var result:number = United_States_to_Canadian*A
return result;
}
Type, starting at the next line of the ActionScript 3 editor, the code that will call the "convert_fn" function when the "Enter" key is depressed when the mouse cursor is in the "UnitedStates_Currency" text field.
UnitedStates_Currency.addEventListener(KeyboardEvent.KEY_DOWN, convert_fn)