ActionScript 3 Error #2078

Flash / Flex Error #2078: The name property of a Timeline-placed object cannot be modified.

ActionScript 3 Error #1061 Description:
The MovieClip or Button that you have on the stage cannot be changed with code. It already has a name so you can’t change it. If you are visiting this page my guess is that you are thinking that you have a dynamic movieClip that you named with code, yet you probably have one with the same name on the stage already.

Flash / Flex Error 1061 Fix:
Stop trying to change a named object on the stage that already has one.

Bad Code:

myMovieClip.name = “Bob”;

Good Code:

//no code here

Thanks and Happy Flashing

Curtis J. Morley

AS3 Error 1188: Illegal assignment to class Boolean.

ActionScript Error #1188: Illegal assignment to class Boolean.

ActionScript Error #1188: Illegal assignment to class Number.

ActionScript Error #1188: Illegal assignment to class int.

ActionScript Error #1188: Illegal assignment to class uint.

ActionScript Error #1188: Illegal assignment to class String.

ActionScript Error #1188: Illegal assignment to class Array.

ActionScript Error #1188: Illegal assignment to class Object.

ActionScript 3 Error #1188 Description:

AS3 error 1188 is thrown when the keyword “var” is omitted. Adobe doesn’t offer any documentation on this ActionScript Error and the description itself is no help at all. This error will be thrown whenever the “var” keyword is missing on all variable assignments including a custom Class/Data Type. I have never experienced this error without also getting AS3 Error 1067 first.

Flex / Flash Error 1188 Fix:
Don’t forget the var when you define a new variable.

Bad Code:

import com.errors.CustomObj
myCustomObj:CustomObj = new CustomObj();
myObj:Object = new Object();
myBool:Boolean = false;
myint:int = -1;
myString:String = “Happy Flashing”;
myArray:Array = new Array();

Good Code:

import com.errors.CustomObj
var myCustomObj:CustomObj = new CustomObj();
var myObj:Object = new Object();
var myBool:Boolean = false;
var myint:int = -1;
var myString:String = “Happy Flashing”;
var myArray:Array = new Array();

Related Errors:

ActionScript Error 1067

This should help you resolve Flex / Flash Error #1188
Thanks and as always Happy Flashing

Curtis J. Morley

ActionScript Error 1136: Incorrect number of arguments. Expected 1.

1136: Incorrect number of arguments.  Expected 1.

ActionScript 3 Error #1136 Description:
This is a generic yet simple ActionScript Error.  It just means that you need one and only one argument in the method you are calling.  This error will pop up in many cases but I will only provide one code example. It should help you get through this fairly easily.

Flex / Flash Error 1136 Fix:
Add the applicable argument/parameter into the parenthesis.

Bad Code:

newempty1.removeChild();

Good Code:

newempty1.removeChild(pic1);

This should help you resolve Flex / Flash Error #1136

Thanks and as always Happy Flashing

Curtis J. Morley

ActionScript Error 1083: Syntax error: doubledot is unexpected.

ActionScript Error 1083: Syntax error: doubledot is unexpected.

var intLat:Number = ((Math.random()*1)*..00060

ActionScript 3 Error #1083 Description:
AS3 error 1083 says that you have too many dots.  Look carefully at the line of code and you will most likely see that your speedy typing fingers hit the period one too many times.  This can happen while targeting an object or when you are using decimals.  Doubledot is valid in AS3 but only in the context of E4X.  You use doubledot otherwise known as the descendent accessor (..) operator to access child properties of an XML object.

Flex / Flash Error 1083 Fix:
Remove the extra dot.

Bad Code 1:

var intLat:Number = myNumber * ..0006;

Good Code 1:

var intLat:Number = myNumber * .0006;

Bad Code 2:

this..myObj.x = 100;

Good Code 2:

this.myObj.x = 100;

This should help you resolve Flex / Flash Error #1083

Thanks and as always Happy Flashing

Curtis J. Morley

ActionScript Error #1067 – Implicit coercion of a value of type void to an unrelated type Function.

ActionScript Error #1067: Implicit coercion of a value of type void to an unrelated type Function.

ActionScript 3 Error #1067 Description:
AS3 error 1137 is describing the fact that you have entered a parameter that is not supposed to be inside the parenthesis.

Flex / Flash Error 1067 Fix:
Remove all parameters from within the parenthesis.

Bad Code 1:

alone_btn.addEventListener(MouseEvent.MOUSE_UP, trace(“The message”));

Good Code 1:

alone_btn.addEventListener(MouseEvent.MOUSE_UP, traceMe);
function traceMe (e:MouseEvent)
{
trace(“The message”);
}

AS3 Error # 1067: Implicit coercion of a value of type String to an unrelated type int.

ActionScript 3 Error #1067: Implicit coercion of a value of type Boolean to an unrelated type int.

Bad Code 2:

var TargetDate:Date = new Date(_year, _month, _date, _hour, _minute=false);

or

var TargetDate:Date = new Date(_year, _month, _date, _hour, _minute=String);

Good Code 2:

var TargetDate:Date = new Date(_year, _month, _date, _hour, _minute=10);

AS3 Error 1067 Fix #2 – In the example below you will see that the function “Return Type” is listed as “int” when it needs to be listed as String.  To fix this simply change the Return Type to String or return a valid integer.

Bad Code:

function bob():int
{
return “message”;
}

Good Code:

function bob():String
{
return “message”;
}

Related Error(s):
Flash / Flex Error 1188
AS3 Warning 1102

This should help you resolve Flex / Flash Error #1067

Thanks and as always Happy Flashing

Curtis J. Morley

Updated info on ActionScript 3 Warning #3590

Updated info on AS3 Warning #3590

I added some data to ActionScript Warning #3590

Go check it out.  For anyone transitioning from AS2 to AS3 this will be very helpful.

Happy Flashing,

Curtis J. Morley

ActionScript ReferenceError: Error #1056

ReferenceError: Error #1056: Cannot create property _x on flash.display.Sprite

or

ReferenceError: Error #1056: Cannot create property someVar on flash.text.TextField.

ActionScript 3 Error #1056 Description:
AS3 error 1056 appears when you have improperly referenced a property of an object. This will happen when you misspell something or when you reference variables in the AS2 fashion with a leading underscore ( _ ). AS3 error 1056 is actually pretty nice to work with because it tells you exactly what variable didn’t work and it tells you which object it didn’t work on.

You can also get this error if you try to dynamically assign a variable to an object that doesn’t naturally accept one like a textField.  See Bad Code 3.

Flash / Flex Error 1056 Fix:
Simply spell the property correctly or make sure that you are using AS3 Syntax instead of AS2.


Bad Code 1:

var s = new Sprite();
s._x = 100;

Good Code 1:

var s = new Sprite();
s.x = 100;

Bad Code 2:

var t = new Timer(1000, 4);
t.dela = 500;

Good Code 2:

var t = new Timer(1000, 4);
t.delay = 500;

Bad Code 3:

myTextField.someVar = “something”;

This should help you resolve Flex / Flash Error #1056

Thanks and as always Happy Flashing

Curtis J. Morley

Related ActionScript Error(s):
Flash / Flex Error 1119
– You will get AS3 Error 1056 instead of 1119 if you don’t properly type your object before referencing a property on it. For example var s:Sprite = new Sprite(); s._x = 10; will give error 1119 but var s = new Sprite(); s._x = 10; will give Error 1056.
Flash / Flex Error 1151
Flash / Flex Error 1069
– This is the error you will get if you try and call a method with a misspelled name in the same way as calling a property with a misspelled name.

Flash / Flex 3 Error #1061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display:DisplayObject.

ActionScript 3 Error #1061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display:DisplayObject.

ActionScript 3 Error #1061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display:DisplayObjectContainer.

ActionScript 3 Error #1061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display:Stage.

Description:
AS3 error 1061 will pop up when you trying to referencee an object from within a function that receives an Event. When you do this it will reference the DisplayObject or if you call out to this.parent rather than event.target.parent it will reference the DisplayObjectContainer which doesn’t have a lot of methods with it.

Fix:
One solution to solve Flex/Flash Error 1061 is to make sure that you are using the event that is passed as the target by using

Bad Code 1:

getStarted_btn.addEventListener(MouseEvent.MOUSE_UP,gotoFrame10 );

function gotoFrame10 (e:MouseEvent)
{
this.parent.gotoAndStop(10);
}

Good Code 1:

getStarted_btn.addEventListener(MouseEvent.MOUSE_UP, gotoFrame10);

function gotoFrame10 (e:MouseEvent)
{
e.target.parent.gotoAndStop(10);
}

This should help you resolve Flash / Flex Error #1061

Thanks and as always Happy Flashing

Curtis J. Morley

Flex / Flash Error #1151

ActionScript Error #1151: A conflict exists with definition progBar in namespace internal.

ActionScript 3 Error #1151
Description:
AS3 error 1151 is an easy one. This means that within your ActionScript class(namespace internal) there is already a variable or function by that name.

Fix:
To solve Flex/Flash Error 11151 just hit CTRL-F(Apple-F) and search for that term that has a conflict and change it to something appropriate. You may have been building a particle system or working with an X or Y variable and forgot to change one of them so that they both read exactly the same. The example below shows what I mean and how to solve the issue.

Bad Code 1:

public class Particle extends Sprite
{
public var xVelocity:Number;
public var xVelocity:Number;

Good Code 1:

public class Particle extends Sprite
{
public var xVelocity:Number;
public var yVelocity:Number;

This should help you resolve Flash / Flex Error #1151

Thanks and as always Happy Flashing

Curtis J. Morley

Related Error(s) : ActionScript Error #1024 , ActionScript Error #1056