Pages

Monday, November 28, 2011

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

7 comments:

  1. thanks! nice example...

    ReplyDelete
  2. hahah this is hilarious :D

    ReplyDelete
  3. Lol I don't think you explained line breaks so I just figured it out on my own after reading the trace. :p

    ReplyDelete
    Replies
    1. I don't know how you figured out but pls tell me....

      Delete
    2. Pls tell me how you figured out?

      Delete
  4. this is awesome thanks a lot

    ReplyDelete