Authentic voices. Remarkable stories. AOL On Originals showcase the passions that make the world a more interesting place.
Hank Azaria’s touching, humorous, and often enlightening journey from a man who is not even sure he wants to have kids, to a father going through the joys, trials and tribulations of being a dad.
Gwyneth Paltrow and Tracy Anderson spend time with women who've overcome hardship, injury, and setbacks to triumph in the face of adversity.
Enter the graceful but competitive world of ballet through the eyes of executive producer, Sarah Jessica Parker. This behind-the-scenes docudrama reveals what it takes to perform on the ultimate stage, the New York City Ballet. Catch NYCB on stage at Lincoln Center.
ACTING DISRUPTIVE takes viewers inside the businesses and passion projects of Hollywood’s top celebrities.
Explore what it means to be human as we rush head first into the future through the eyes, creativity, and mind of Tiffany Shlain, acclaimed filmmaker and speaker, founder of The Webby Awards, mother, constant pusher of boundaries and one of Newsweek’s “women shaping the 21st Century.”
They say every picture tells a story and AOL On's new original series My Ink proves it. Travel along as some of the world's greatest athletes bring their tattoos to life through exclusive interviews and visits to their favorite tattoo parlors.
Discover crowdfunded small business success stories with author, comedian, and entrepreneur Baratunde Thurston.
Go behind-the-scenes with racing's hottest, young talent, 17-year-old Dylan Kwasniewski, as he aspires to make it in the #1 motorsport in America – NASCAR
Follow Scott Schuman, the Sartorialist, from the streets of NYC to the capitals of Europe on his quest to photograph and document the best in culture and fashion.
Iconic potter, designer, author and personality Jonathan Adler shares his unique perspective on creativity. Showcasing the inspiration Jonathan finds in the most unlikely people and places, Inspiration Point will add style, craft and joy to your life.
Serving Innovation gives a fresh look into the stories and passions that motivate some of the most innovative tastemakers in America.
A documentary directed by Alex Winter exploring the Napster downloading revolution; the kids who created it, the bands and businesses that were affected and its impact on the world at large.
Nicole Richie brings her unfiltered sense of humor and unique perspective to life in a new series based on her irreverent twitter feed. The show follows the outspoken celebrity as she shares her perspective on style, parenting, relationships and her journey to adulthood.
Now, so far we have tried out variables with numbers but as I said before, we can store lots of things in our variables as we make them. I can make another variable down here below called market. I will use my var keyword once again. I will setup my market variable and this time I am going to use the equal sign and set it equal to the word farmers.
Now, notice I put that into quotes because this is what we are calling a literal string and a string refers to a string of characters or characters next to one another. That's what our typical words, sentences and paragraphs are referred to in programming language. Now, I can set a semicolon at the end of this and I can trace our new market variable just like I have the other ones. I will use the trace statement. I can just use market since we have already declared it with our var keyword in the previous line. Close the parenthesis and we will close off the statement with the semicolon and when we test our movie, we can see that the Trace function shows us the value of the market variable as the word farmers.
Now, this does bring up an interesting topic and something to watch out for when creating variables. When we start mixing these two types together, we can end up with some unexpected results. So, let me give an example of that. I am just going to use a Trace statement right below here to trace out the value of two known numbers. I am going to trace out the result of adding the 4, use a plus(+) sign to the 5. Now, I think we all know exactly what that is going to come out to. We are going to get 9 when we test our movie and there we can see the 9 right below the trace of the market variable.
Not a very unexpected result, but if we had these two value instead of being numbers to be literal strings, it would look like this. We will setup our Trace statement and this time, I am going to put 4 in quotes and I will add it to 5 in quotes. Again, I will end my line with a semicolon and now you might think that this should still be able to add those two numbers together because we are using numbers as characters all time but when we trace this, we get a little interesting result. Now, it appears that it is giving us the number 45 and we know that's not what you get when you add 4 and 5 together. But if you stick the character 4 next to the character 5, you end up with 45.
Now, these types of results can really mess up a piece of code. So, in ActionScript 3.0 and in ActionScript 2.0, we have a way of dealing with this and it is called Data Typing. What we are going to be doing is specifying when we create a variable, what type of data will be stored in that variable. Now, let me just get rid of these last two trace statements since we don't need them anymore and let's see if we can put this in context with the variables that we have already created. We have created an apples variable and we intend for this variable to contain a number. So, to set a data type on this variable, I will use the colon and I will add to this what type of data we are going to be putting in.
Now, as we can see a Hint Panel has popped up on the screen and this is giving the access to a lot of different types of data that the program can handle. I am just going to focus on some simple ones right now. For instance, if we go down here to the N's, you can see that we have Number. Now, also notice that Number is a capital N which is why we normally use lower case letters to start out our variable names. As I start typing, you can see that my Hint Window is scrolling down to the ends. When I type U, it goes to Null and when I type N, it actually goes to Number. Now, to make use of this kind of hint in the program, when the Hint Panel scrolls down to the element that you were thinking of typing, you can just hit the Enter key and it will finish typing for you. Now, just like the var keyword, you notice that Number turns blue and that's showing me that it has found the right reserved word in the program and now I will only be able to add a number type of a value to my apples variable. Now, just to try this out, I could take my variable, pop it into quotes and that would flag it as a literal string, as a character instead of a number and if we try to test our movie, you can see that instead of tracing out of all of our scripts, we actually get an error. Now, this looks like a complicated sentence but it basically says, we try to put a string into a number-typed variable. Of course, to fix that, we will just put that back to a number.
Now, let's review variables. In order to create a variable, I need to use the var keyword to declare the variable and as an option, I can add in a data type to each variable. It's actually a good idea to get in the habit of doing both, because as you can see, this will keep you from making some very simple mistakes that would be hard to find otherwise as soon as we start writing much more complex code.
So, in order to setup the other two variables that we have already declared, I am going to add a number type to our oranges variable. Then once again, I am going to type :Number and I can use the hint system to finish typing for me. If we take a look at our market variable, we don't want to declare this one as a number because we want to able to put string characters into this one. So, I am going to use my colon here but instead of number, I am going to type String with a capital S. There you can see the hint has gotten down to it with STR. I will just hit the Enter key and it will finish off the typing for me.
Now, just to give you an idea of one of the other data types that we can create in a program, let's create another variable down here on the last line. I will use my var keyword to declare it. I am going to call this variable vegetables and I would like to simply store into this variable a true or a false value. Now that's referred to as a boolean. So, I am going to type that by using a colon character and we will type in Boolean with capital B. Now, since all of the elements represented on our screen are fruits instead of vegetables, I am going to set this equal to false and as you can see that turns blue as well indicating that this is a reserved keyword in the program and we can just store that false value right into that variable vegetables.