Wednesday, October 21, 2009

Step 6 - Variables (in Flash)

Well, this is something that I ended up learning quite a bit sooner than I thought I would, but that's OK. I'll present some evidence that I know what a variable is and can use it at least in an elementary way.

I use variables successfully in pretty must every session of class and on several of the steps I've already posted on this blog. Here's an example of a little code from my game Heinous Heist:

var v_name = inputName_txt.text;

In this line, the "var" means that I'm creating a new variable and this new variable's name will be "v_name". The equals sign means I am assigning a value to this variable based on an input text box named "inputName_txt". So, whatever the user puts in this text box will be the value of v_name. And finally, the ".text" is simply saying that the kind of value this will be is text.

I would give myself a 10/10 on this step because I've more than met my personal expectations for this step, can and do use variables successfully on a regular basis and I feel I've met the requirements for this step.

1 comment:

  1. Dan,
    The irony in the fact that this is second nature to you by now is that there is actually an error in the above code. Find it and I'll accept the 10 you've awarded yourself. Otherwise, we'll reconsider ... ;)

    ReplyDelete