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

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.

After creating an ActionScript file, our next goal is to write the code. So, once all file tasks are done, we can start using that file. Before actually beginning to write code, there are a few basic things one must remember while dealing with programming:

  1. The number of braces that open must be equal to the number of braces that close. Hence, to maintain the balance between these braces, we must close every brace as soon as we open it. Thereafter, the code will go within these braces – this helps avoid any errors that might occur when there's a brace imbalance in a program. (02 Tip: In AS3, you can press Alt-quote and Flash will highlight all the code within the closest brackets: this can be a life-saver!)
  2. We must import all the required library files inside the section of the package. We must also include the parent class, which can be directly used in the program without rewriting it because of the overriding and overloading concepts.
  3. The main code is written in the Main() constructor function. Also remember that a function name is always followed by open brace '(' and a closed brace ')'. These parenthesis can either be empty or we can pass arguments through them. However, the concept of passing arguments into functions is a topic to which we'll dedicate an entire title, in later chapters of this series that cover working with functions.

Now, once you complete the code inside the main function, you must save the file in the source folder. The process of saving files in source and deploy folders has already been discussed in previous videos. You can take a quick peek at the previous videos to refresh your memory. One new thing here is that you must save your file with the same name of your main class. Moreover, the first letter of the class name must be in uppercase.

Now, we have two saved files: main.fla and Main.as. Hence, we must create a link between these two files:

Be sure you're in your main.fla file, then (if the properties panel isn't open,) select the window menu and click on the properties option.

When the properties panel is open, you can find the “Class” box. Type in the class name you just created without any extension (aka 'Main').

Finally, click on the small pencil next to the box: if your class editor opens, that means you did everything right. Way to go!

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