Introduction to Flash and Actionscript
Variables and Arrays
Variables in Actionscript 3.0
Values to Variables
( variableName = value;)
Printing Values of Variables using trace
- add the following lines and test your program
- change the values and add additional trace lines to produce the following output
#1 - Using Text Boxes to Display Output
Create a TextBox on the Stage.
Make it Classic Text, Dynamic and embed it
Give it the instance name myTitleBox_txt
Using Code add a Title into the textbox
Now create 3 variables to store the following data: Name, age, date of birth (string, int, string)
Assign values to the variables
Create 3 text boxes for headings.
Create 3 text boxes to store values and 3 buttons. (Under the Headings)
When the button is clicked display the information in the appropriate text box using the variables
myName_txt.text = strName // StrName is a string variable
myTextBox_txt.text = String (intAge) // intAge is an integer variable so we change it to a String before putting in text box
Make the boxes interesting and nicely formatted
Every line of text must be commented.
#1 - Restaurant Bill
- Restaurant Bill
Every line must be commented.
Every line must be commented.
A fast food restaurant charges $4.89 for burgers, $2.59 for fries and $1.50 for sodas.
Create an Bill that calculates the total cost of burgers, fries, and sodas and then displays the total, the tax (13%) and the final cost and a thankyou message from the waitress.
The order is for 5 burgers, 6 fries, and 7 sodas.
Create the following variables: numBurgerPrice, numFryPrice, numSodaPrice, intBurgers, intFries, intSodas, strWaitress
Assign values to each of the variables for price, quantity, and waitress name.
Create a variable for subTotal (numsubTotal) and calculate the value.
Create a variable for tax (numTax) and for total (numTotal) and calculate each.
Note: to round to 2 decimal places use:
Make the output interesting, include graphics!
Tutorial #2 - Getting Information from TextBoxes
Instead of assigning values in our code, we can get variable values from the user using input Text Boxes.
Create 2 Textboxes one for age and one for Name. Set them as input in the Properties box.
#2 - Bill of Sale
- Bill of Sale
Create a purchase program that has input boxes for the following.
You must allow the user to purchase 3 items.
Then in a Text Box display a Bill that includes product name, price, quantity, subtotal, tax, and final total.
Then allow the user to enter the amount of cash they are paying with and display the change they will received.
Post your .fla and .swf. There is no Rubric for this section,
it was for learning purposes and will only be evaluated for completeness (20 marks) and comments(20 marks).
Remember every line needs a comment. Yes!!!!! Every line.
and Beyond Assignment #4 -
- Sleep ZZZZZZZZ
Calculate the number of hours of your life that you have spent sleeping. Assume that you sleep 8 hours each night. To simplify the problem, assume that there are 30 days in each month and 365 in each year.
Enter your birth date:
You have been alive for 5,634 days.
and Beyond Assignment #5 -
a pizza ordering program that includes at least the following:
Design a pizza ordering program that includes at least the following:
quantity, toppings, drinks.
size, quantity, toppings, drinks.
is your Above and Beyond assignment so make sure to add additional
items and features to obtain all possible marks.
This is your Above and Beyond assignment so make sure to add additional items and features to obtain all possible marks.