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

Strings As Our First Variable

<p>Developers use <a href="/courses/video/5/157/Using-Variables.html">variables</a> 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. In this video we will work with our first Data Type: the '<a href="/courses/video/4/154/Strings-As-Our-First-Variable.html">String</a>'.</p> <p>Time to explore the procedure for creating variables and using it in a program. We will first deal with strings before going to <a href="/courses/video/4/156/Numbers-As-Our-Second-Variable.html">numbers</a>. Assigning a string to a variable requires the variable to be <b>declared</b> first along with the <a href="/courses/video/5/161/Numbers-int-And-unit.html">data type</a>. We declare a variable like this:</p> <p>var longAssedStr: String;</p> <p>Here we can see that the keyword &quot;var&quot; is required to declare any variable. &quot;longAssedStr&quot; is the variable, and the part following the colon shows what <b>type</b> of data this variable is. For strings, would you believe the data type is &quot;String&quot;?? Sure enough it is, so we type the colon followed by &quot;String.&quot; The variable declaration must always end with a semi colon as shown.</p> <p>After declaring a variable, we must assign a string to it if we want to use it later. This can be done in the same line where the variable is declared, in the next line, or elsewhere in the code. We will discuss the first two methods in this section.</p> <p>Firstly, most developers prefer to declare and assign a variable in a single line: saves space and is more readable. For this we type:</p> <p>var yoMamaStr: String = "wears army boots";</p> <p>Here we can see that the semi colon is moved to the end of the line of code, after the string and the variable is set to equal some string within double quotes. Finally, the line must end with a semicolon. In this way the variable is declared and assigned within the same line.</p> <p>There is another process where we declare the variable in one line and assign data to it in another line. For this we first declare the variable as we said earlier, along with the semicolon. In the next line we type</p> <p>yoMamaStr = "wears army boots";</p> <p>The result is same but two lines are used here instead of one. Remember that even the second line must be ended using a semi colon: every line of code you write must end in that semicolon! These little things are very important to remember because they can cause <a href="/courses/video/4/155/Error-1067-Implicit-Coercion.html">errors</a> during compilation. Nasty errors.</p> <p>After declaring and assigning a variable using either method, next we see how to use it in the program later. This is very simple and we just need to type the variable in the <b>trace</b> <a href="/course/basics/functions">function</a> to print the actual data. It looks like this:</p> <p>trace(yoMamaStr);</p> <p>Unlike <a href="/courses/video/4/156/Numbers-As-Our-Second-Variable.html">numbers</a>, a <a href="/courses/video/4/154/Strings-As-Our-First-Variable.html">string</a> is the <b>only</b> text data written in double quotes, so it cannot be subjected to any modifications.</p>

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