02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

What Are Variables?

Developers use variables to save and store information that they want to access and reuse in the future. Learn how to create different kinds of variables and see how they can make your life easier as your code gets more complex.

Dealing with variables is one of the basic foundation blocks of programming. Introduction of variables into our programming solves many complications and helps us minimize code. The main role of the variable and its usage is discussed later when we start working with functions. For now, we just need to understand what a variable basically is and its main usage.

A variable holds data the way a pot holds spaghetti noodles. You could cook one at a time: we can't think of a reason why, but you could! Same goes for variables: they contain data instead of noodles. For instance, a variable (such as strData) is a perfect alternative to lengthy data such as a string. For example, if we want to print a string many times within the code, we may find it difficult to type it again and again especially if the data is comprised of many characters. In such cases, we can assign that data to any variable, use it in any part of the program and the compiler sees that variable as the real data that was initially assigned to it.

Hence, the code length can be reduced drastically with the use of variables. For example, take the string "Learning AS3 at 02geek.com is very easy." For some weird reason, we must use this multiple times in our program – say 100 times -- just to discover that we had a small typo in every single one (oh dear)... If we had one variable that contained this string we could have simply updated that variable and in so doing, updated each spot where that variable was used. So we should assign this data to a variable, say 'go02str': go02str now refers to the actual sentence wherever it is used in the program later.

The need for variables becomes mandatory when we use functions. Functions are declared first and can be called any number of times within a program: functions often have variables as arguments. For now we must remember that a variable can replace a lengthy string and can be used multiple times within the program. In the following videos we will be mainly working with variables, so don't worry if its not 100% clear yet: there's nothing like some real world practice!

The most important knowledge you should retain from this video is the understanding that variables are containers that contain data (such as our string) and can be used in place of that data, once they are defined.

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!

Intro

In this video, we will learn the basics concepts of coding in Flash. The main focus is on the output panel. Once we understand Flash's environment, then we learn how to manage the output panel.

03:16

Publish Settings Recap

Get into a rhythm of efficiently setting up your files so you can smoothly transition into writing code. This video shows you how to compile your .swf and .html files..

03:41

Setting Up Our Main Class

Get into a rhythm of efficiently setting up your files so you can smoothly transition into writing code. This video shows you how to set up your script for all the code you'll write from here on out.

04:51

Test Movie

The basics of working with Flash, focusing on the publish settings and testing movies.The basics of working with Flash, focusing on the publish settings and testing movies.

00:58

Trace

For your first programming task, you'll experiment with the 'trace' function and learn how to output data from your application. This can be used to print the desired text at will.

04:08

Single Line Comment

In this video we will learn the syntax of single line comment and the need for its existence in programming, and explore how to create them in actionscript 3 flash.

01:25

Numbers And Basic Math

In order to do great things in flash, all you need is a grasp of basic math. So let's work on computing mathematical equations using the 'trace' function.

06:42

Answer To Math Question

In order to do great things in flash, all you need is a grasp of basic math. So let's work on using the Trace function to compute mathematic equations. We ended the last video with a question, let's s

01:40

Multi line Comments

You already know how to comment line by line but wouldn't it be nicer for you and your fingers if you could cancel out a full block of code? Yes, it is possible using multi line comments.

01:40

What Are Variables?

Learn how to create different kinds of variables and see how they can make your life easier as your code gets more complex. They play a major role in writing the code efficiently.

02:20

Strings As Our First Variable

learn how to create your first string variable in actionscript flash. This video helps you understand how to declare a variable and assign a string to it.

03:42

Error 1067: Implicit Coercion

Help-I just got the dreaded 1067 error... ohh actually it is not that bad it is telling me something... but what? Let’s learn about 1067 error and know how it is helpful to the user

01:21

Numbers As Our Second Variable

Learn how to create different kinds of number variables and see how they can make your life easier as your code gets more complex. Also learn the syntax for declaring all types of numbers

01:56