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

Numbers And Basic Math

<p>As long as we pass a <a href="/courses/video/4/154/Strings-As-Our-First-Variable.html">string</a> inside the <a href="/courses/video/4/31/Trace.html">trace</a> <a href="/course/basics/functions">functions</a> such as <b>trace("I am a string, baby!");</b>, the output is the string itself. If we pass a <a href="/courses/video/4/156/Numbers-As-Our-Second-Variable.html">number</a> instead of a string inside the quotes, the result is still the same i.e., the number which was inputted. But when we write the number into a trace function without double quotes or single codes, the result is different. For example <b>trace(200);</b>, since 200 is not written inside double quotes, it is not considered as string. It is considered as live data, in our case a number. Hence, any modifications can be performed inside the parenthesis and the final answer is displayed on the output panel as flash will automatically convert the number into a string just before it triggers the function.</p> <h2>Simple mathematical Operations</h2> <p>Let's consider a simple math equation written inside trace in this way: <b>trace(200-100);</b>. Instead of printing the output as 200-100, the output is '100'. This happens because <b>before</b> the value is sent to the trace function – it will first calculate the operation (200-100=100). Only when the final value is reached will it be sent through to the output panel. All the basic math operations (of any length) can be performed by Flash.</p> <h2>Level of priority for math symbols</h2> <p>As the length of an equation increases, do does the difficulty for calculating it. This is because various symbols (+,-.*) are used in an equation and no priority for symbols is specified to the compiler by the user. (When we refer to symbol priority, we are discussing the order in which those symbols are calculated in an expression such as 'x + y * z'. What is done first? x+y or y*z? It depends on the symbol <b>priority</b>.) Flash uses the same level of symbol priory that all programing languages do. In general, multiplication and division have the highest priority while addition and subtraction have the least.</p> <p>For example, if we consider 10-3*2+5 and start simply evaluating from left to right, the answer would be 19, which is wrong. Not being aware of the symbol priority can produce unexpected/incorrect results. Hence, we must follow the basic math principles and evaluate high priority symbols first: in this case, multiplication (*) before addition. The proper equation becomes 10-6+5. Since all the rest of the symbols have the same priority, the evaluation can be started either from left or right or even from the middle. The answer remains the same and is always correct . Flash follows the basic priority level rules of math. If you don't realize this factor you'll find yourself getting confused often - if your match skills aren't very high its not the end of the world: instead you just use round braces() to gather mathematical equations into groups and help you visualize this rule (for example (10-(3*2) +5)).</p> <p>There may be a few instances where we want the evaluation to start at a certain part irrespective of the priority. This is also possible with the help of (), which has a higher priority than multiplication and division. The part of equation that needs to be evaluated first can be included in the parenthesis and therefore be evaluated first. However, after completing the evaluation inside the parenthesis, Flash again follows math basic priorities to evaluate the rest of the equation. In some cases, if the part that needs to be evaluated inside the parenthesis is big, Flash follows the same priority principles for evaluating that part inside the parenthesis.</p> <p>This might look little confusing, but when you start working, you'll quickly get used to it (our exams will help you a lot with it as well.) Take some time now and use trace to solve some equations for you, such as</p> <p>trace(4+5*8-3); //can you guess the answer before you compile these?</p> <p>trace((4+5)*8-3);</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