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

Error 1067: Implicit Coercion

Help! I just got that dreaded 1067 error... ohh actually it's not that bad, it's telling me something: 1067: Implicit coercion of a value of type int to an unrelated type String. But what on earth does THAT mean? (We saw a headline in today's paper: "Little Girl Coerced into Car." This must be one scary bug!)

When the compiler detects something wrong with the code, it generates an error. There are different types of errors: Runtime errors and Compile time Errors. (We covered Runtime vs. Compiler errors here.) The error we're discussing here is a compile time error, so we'll learn why this error happens and how to debug it. We learned from the previous classes that the data type assigned to the variable must be same as the data type used for the declaration of variable. When the user forgets this rule, there is a pretty good probability that this error is going to show up.

For example, consider a variable that is declared initially using the data type String. Now, this variable is just like a container which can hold ONLY data of type String. So if we assign string data to this variable later in the program, it will compile normally without any errors. But if we assign a different type of data to this variable, number for example, then this will cause an error and is referred as Implicit Coercion Error.

This happens because when data is assigned to this variable, the application expects it to be a string written within double quotes such as

str="Flash";

But when a number of type integer is assigned to this variable, the compiler detects the mismatch of data types and generates an error. (02 tip: many developers have a charming term for when any error occurs: "it just puked." Hey, WE didn't invent it!) One should be very careful while assigning and declaring variables. Even after taking all possible precautions, there is still a possibility for this error to happen: after all, we're human beings. It's best to be aware of all types of errors: the syntax error (code typed wrong, function not used correctly, etc.,) the implicit error or any other type of error. When the error is a syntax error, there is no point in checking every single variable for mismatch of data type, wasting time. We can directly check for any error in syntax of the code and fix it. But when we see that the error is an implicit error, one has to realize that it is caused mostly due to a mismatch of variables and as such debug it accordingly.

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