PART 3 - Fun with ActionScript 3 variables: Complete the story - Introduction to Flash AS3 Variables
Tutorials

PART 3 - Fun with ActionScript 3 variables: Complete the story - Introduction to Flash AS3 Variables



Create a new Flash ActionScript 3.0 document. Then copy the code below and paste it in the script pane of the Actions Panel. Do not read the trace statement! Just read the variables so as not to spoil the activity.

Your task is to replace the value of each variable with whatever is suggested in order to complete the story in the trace statement. Do not remove the quotation marks when you replace the values. Once all the values have been replaced, test your movie, then go to the output window to read your story. You can do this activity with a friend and try to think of funny and ridiculous values for each variable.

var popArtist:String = "name of famous pop artist";
var cheese:String = "name of type of cheese";
var chemElement:String = "name of chemical element";
var bodyPart:String = "name of external body part";
var internalOrgan:String = "name of internal organ";
var songTitle:String = "title of cheesy love song";
var fighter:String = "name of famous martial artist or boxer";
var fungalInfection:String = "name of a type of fungal skin infection";

trace("A new superhero has been spotted around campus, leaping from building to building. Who is he? Are you sure you wanna know?\n\nRumor has it that this superhero is a student on campus who was bitten by a radioactive " + popArtist + ". When he woke up, he felt very strange, but still decided to attend class. His classmates thought he was acting strange, and they began to avoid him because he started smelling like " + cheese + " mixed with burnt " + chemElement + ".\n\nBut things changed when a crime occurred on campus in the afternoon of that same day. A young girl was being held at gunpoint, and was being asked to surrender her fake " + bodyPart + ". Then out of nowhere, a blurry figure came rushing to save the girl! It was the student who smelled like " + cheese + " and " + chemElement + "! He was now dressed in a lovely costume designed by " + fighter + ". With great speed, he went straight for the gunman and kicked him right in the " + internalOrgan + ". He kicked him with such great force that it made the gunamn scream: " + songTitle + "! And then the gunman ran away. The young girl was safe. And the students cheered!\n\nHappy and thankful, the young girl came up to her savior, gave him a kiss on the cheek and asked, \"What is your name, kind sir?\" To which our brave superhero replied: I am " + fungalInfection + " Man!");

//Story credits:
//dip magazine, August 2002 issue

After completing this exercise, try making your own version, and ask your friends to fill in the variables.

<< PREV: Variable Naming Rules and Conventions - Introduction to Flash AS3 Variables - PART 2




- Distance Learning - Cs179.11 A - Sem 01 Sy 2012-13
July 24, 2012 Hi, everyone. So for this session, we will be starting with ActionScript. The learning resources below will teach you what ActionScript is, and how to add some ActionScript code to a Flash project - that's going to be what's covered...

- Expressions And Operators In Actionscript 3
An expression is something that computes or evaluates into a single value. In a very simple form, a reference to a variable is already an expression. For example: var quantity:Number = 5; trace(quantity); Here, the variable quantity evaluates to a value...

- Local And Global Variables In As3
In the example below, you will see two variable declarations and one function: var outsideVar:String = "outside of the function"; function myFunction():void { var insideVar:String = "inside of the function"; } myFunction(); In the example above, we...

- Part 2 - Variable Naming Rules And Conventions - Introduction To Flash As3 Variables
PART 1: Creating ActionScript 3 Variables and Assigning Values to themPART 2: Variable Naming Rules and ConventionsPART 3: Fun with Variables - Complete the Story Variable names are author-defined. This means that you, as the author of the Flash ActionScript...

- Actionscript 3: Convert Strings To Numbers
In this lesson, we are going to learn how to convert strings to numbers in AS3. You can convert strings that are made up of numerical characters into actual Number data using the Number() constructor. The way it works is that you pass the String value...



Tutorials








.