Flex / Flash ActionScript Error #1094

ActionScript Error #1094: Syntax error: A string literal must be terminated before the line break.

Description:
Error 1094 is a simple and fairly well described ActionScript Error.  This error will appear when you have left off the closing single quote marks in a particular line.  This is very closely related to AS3 Error 1095 which will help you out when you improperly use double quotes.  You will most likely get AS3 syntax error 1083 and syntax error 1084 after this this one.  These can most likely be ignored and will go away once the 1094 error is taken care of

Fix:
End the string properly by putting double quotes in the proper place

Bad Code:

trace(‘This is missing a single quote + someVar);

Good Code:

trace(‘This is not missing a single quote’+ someVar);

Related ActionScript Errors – AS3 Error 1095AS3 Error 1084

This ActionScript Error is a quick one. I hope this helps you solve it.

As always Happy Flashing

Flex / Flash ActionScript Error #1095

ActionScript Error #1095: Syntax error: A string literal must be terminated before the line break.

Description:
Error 1095 is a simple and fairly well described ActionScript Error. This error will appear when you have left off the closing double quote marks in a particular line. This is very closely related to AS3 Error #1094 which will help you out when you improperly use single quotes. You will most likely get AS3 syntax error 1083 and syntax error 1084 after this this one. These can most likely be ignored and will go away once the 1095 Error is taken care of

Fix:
End the string properly by putting double quotes in the proper place

Bad Code:

trace(“This is missing a double quote + someVar);

Good Code:

trace(“This is not missing a double quote”+ someVar);

Related ActionScript Errors – AS3 Error #1094, AS3 Error 1084

This ActionScript Error is a quick one. I hope this helps you solve it.

As always Happy Flashing

New Scenarios of AS3 Error #1084

I’ve added 3 new scenarios to AS3 error 1084.

You can find it here.

http://curtismorley.com/2007/07/14/flash-cs3-flex-2-error-1084/#comment-2482

The additions are:

1084: Syntax error: expecting leftparen before colon.
1084: Syntax error: expecting rightparen before colon.
1084: Syntax error: expecting rightparen before semicolon.

Flex 2 / Flash CS3 ActionScript Error #1150

ActionScript Error #1150: The protected attribute may be used only on class property definitions.

Description:
This ActionScript Error justs means that you have used the access control modifier ‘protected’ in the wrong spot. There are four access control modifiers – public, private, internal, and protected. Each of these specify how the method or variable is accessed. Each access control modifier has it’s own error but they all mean the same thing. Access control modifiers need to be used in the right place. The ‘internal’ and ‘public’ can only be used inside a ‘package’ and ‘private’ and ‘protected’ can only be used on classes.

Fix:
Make sure to only use the ‘protected’ access control modifier to define a method or variable within the class itself and not within a method(function).

Bad Code:

package{
	public class MySize {
		public function Connection():void{
			protected var borderSize:uint = 0;
			trace(size);
		}
	}
}

Good Code:

package{
	public class MySize {
		private var size:uint = 40;
		protected function Connection():void{
			trace(size);
		}
	}
}

Related ActionScript Errors – AS3 Error 1013, AS3 Error 1114, AS3 Error 1115

This ActionScript Error is a quick one. I hope this helps you solve it.

As always Happy Flashing

Flex 2 / Flash CS3 ActionScript Error #1115

ActionScript Error #1115: The internal attribute can only be used inside a package.

Description:
This ActionScript Error justs means that you have used the access control modifier ‘internal’ in the wrong spot. There are four access control modifiers – public, private, internal, and protected. Each of these specify how the method or variable is accessed. Each access control modifier has it’s own error but they all mean the same thing. Access control modifiers need to be used in the right place. The ‘internal’ and ‘public’ can only be used inside a ‘package’ and ‘private’ and ‘protected’ can only be used on classes.

Fix:
Make sure to only use the ‘internal’ access control modifier to define a class, method or variable within a package and not inside the class itself nor within a method(function).

Bad Code:

package{
	public class MySize {
		public function Connection():void{
			internal var bgColor:uint = 0xFFCC00;
			trace(bgColor);
		}
	}
}

Good Code:

package{
	internal class MySize {
		public var bgColor:uint = 0xFFCC00;
		public function Connection():void{
			trace(bgColor);
		}
	}
}

Related ActionScript Errors – AS3 Error 1013, AS3 Error 1114AS3 Error 1150
This ActionScript Error is a quick one. I hope this helps you solve it.

As always Happy Flashing

Flex 2 / Flash CS3 ActionScript Error #1114

ActionScript Error #1114: The public attribute can only be used inside a package.

Description:
This ActionScript Error justs means that you have used the access control modifier ‘public’ in the wrong spot. There are four access control modifiers – public, private, internal, and protected. Each of these specify how the method or variable is accessed. Each access control modifier has it’s own error but they all mean the same thing. Access control modifiers need to be used in the right place. The ‘internal’ and ‘public’ can only be used inside a ‘package’ and ‘private’ and ‘protected’ can only be used on classes.

Fix:
Make sure to only use the ‘public’ access control modifier to define a method or variable within a package and not inside the class itself nor within a method(function).

Bad Code:

package{
	public class MySize {
		public function Connection():void{
			public var bgColor:uint = 0xFFCC00;
			trace(bgColor);
		}
	}
}

Good Code:

package{
	public class MySize {
		public var bgColor:uint = 0xFFCC00;
		public function Connection():void{
			trace(bgColor);
		}
	}
}

or

package{
	public class MySize {
		public function Connection():void{
			var bgColor:uint = 0xFFCC00;
			trace(bgColor);
		}
	}
}

Related ActionScript Errors – AS3 Error 1013, AS3 Error 1115 , AS3 Error 1150

This ActionScript Error is a quick one. I hope this helps you solve it.

As always Happy Flashing

Flex 2 / Flash CS3 ActionScript Error #1013

ActionScript Error #1013: The private attribute may be used only on class property definitions.

Description:
This ActionScript Error justs means that you have used the access control modifier ‘private’ in the wrong spot. There are four access control modifiers – public, private, internal, and protected. Each of these specify how the method or variable is accessed. Each access control modifier has it’s own error but they all mean the same thing. Access control modifiers need to be used in the right place. The ‘internal’ and ‘public’ can only be used inside a ‘package’ and ‘private’ and ‘protected’ can only be used on classes. AS3 error 1013 can also be caused if you misplace a method identifier like ‘:void’

Fix:
Make sure to only use the ‘private’ access control modifier to define a method or variable within the class itself and not within a method(function).

Bad Code 1:

package{
	public class MySize {
		public function Connection():void{
			private var size:uint = 40;
			trace(size);
		}
	}
}

Good Code 1:

package{
	public class MySize {
		private var size:uint = 40;
		public function Connection():void{
			trace(size);
		}
	}
}

or

package{
	public class MySize {
		public function Connection():void{
			var size:uint = 40;
			trace(size);
		}
	}
}

Bad Code 2:

package{
	public class MySize {
		public function Connection():void{
			someFunction():void;
		}

 	private function someFunction():void{
			var size:uint = 40;
			trace(size);
		}
	}
}

Good Code 2:

package{
	public class MySize {
		public function Connection():void{
			someFunction();
		}

 	private function someFunction():void{
			var size:uint = 40;
			trace(size);
		}
	}
}

Related ActionScript Errors – AS3 Error 1114, AS3 Error 1115 , AS3 Error 1150

This ActionScript Error is a quick one. I hope this helps you solve it.

As always Happy Flashing

Flex 2/ Flash CS3 Error #3590

Flex 2/ Flash CS3 Warning / Error #3590: String used where a Boolean value was expected. The expression will be type coerced to Boolean.

or

Warning: 3590: int used where a Boolean value was expected. The expression will be type coerced to Boolean.

Description:
This is a ActionScript error is more of a warning than a true AS3 error. It will be displayed in strict mode and simply means that you have quotes around your Boolean value. Even though you may get this AS3 error it won’t prevent Flex or Flash from compiling nor ActinoScript code. It will convert it for you though. Thanks Flash for doing that for us.

AS3 Warning #3590 Fix 1:
Make sure that your boolean (true or false is not inside quotes).

Bad Code 1:

myObject.visible = “false”;

Good Code 1:

myObject.visible = false;

AS3 Warning #3590 Fix 2:
ActionScript 3 uses true and False rather than 0 and 1 for boolean. Although it does allow 0 to make it through without giving this error.

Bad Code 2:

myObject.visible = 1;

Good Code 2:

myObject.visible = true;

AS3 Warning 3590: Fix #3*Warning* This method will solve the problem temporarily and allow you to publish your code BUT it will cause you many headaches later. You will not get any warnings or error messages and this is a bad thing I Promise! If you are going to proceed down this path make sure to recheck these boxes after you are done publishing your one problem movie. With that much said, The way you do this is to turn off Strict (Verbose) Error Messages in your preferences as shown below.

Go to File >> Publish Settings >> Click on the “Flash” tab >> Next to “ActionScript version:” click the “Settings…”

AS3 Error 1118 -Implicit Coercion

AS3 Warning 3590 Fix #4 – In the example below you will see that the function “Return Type” is listed as Boolean when it needs to be listed as String.  To fix this simply change the Return Type to String or return a Boolean value “true” or “false”.

Bad Code:

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

Good Code:

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

AS3 Warning 3590 is pretty easy and straight forward.

As always – Happy Flashing

Flex 2 / Flash CS3 Syntax Error #1100

Error #1100: Syntax error: XML does not have matching begin and end tags.

Description:
Here is another easy AS3 error. This Flex/Flash Error means that your XML is not valid because the end tag is simply missing or you left off the end slash (/). *Note: This AS3 error is similar to ActionScript Error #1085

Solution:
Close that end tag.

Bad Code 1

var dogXML:XML =
<dog>
<name>Fido
</dog>

or

var dogXML:XML = new XML();
dogXML =
<dog>
<name>Fido<name>
</dog>

Good Code

var dogXML:XML = new XML();
dogXML =
<dog>
<name>Fido</name>
</dog>

Related Errors:
ActionScript Error #1085

I hope this helps you solve ActionScript Error #1100

As Always Happy Flashing

Curtis J. Morley

Flash CS6 / Flex Error #1009: Cannot access a property or method of a null object reference

TypeError: Error #1009: Cannot access a property or method of a null object reference

ActionScript 3 Error #1009 is an AS3 that you can get for many anecdotal reasons. This error basically means that you are trying to reference something that isn’t there yet. That something can be a variable, data from the server, or even a movieClip or other display instance. So if you try and make a call to something and are getting this error simply look at what you are trying to reference and ask yourself is it there yet.
Don’t bang your head against the wall any longer. Here I explain one of the most un-obvious ways to get this error.

One reason that you will get AS3 Error #1009 is because you are trying to access a movieClip that isn’t instantiated yet. For example you try and reference a movieClip named loader_mc that is inside another movieClip. you are referencing it from a class that you created. Each time you run the test the movie you get the Run-Time Error #1009. You look inside your movieClip and see that the loader_mc is right where you want it. It is on frame 10 inside your animated moveiClip. That is when it dawns on you that the call to loader_mc happens when it is instantiated. Simply, put loader_mc on frame 1 and change it’s alpha to 0 and then the movieClip will be instantiated when the call from your custom class is made.

Another reason for this error is simply incorrect targeting. If you target parent.bob and the correct reference is parent.parent.bob then you will get this error as well.

Fix 1 :

Make sure the the reference is instantiated before it is called.  This means that the script is run after the object is loaded or the frame in the animation has been reached etc…

Fix 2 :

Check your targeting

Thanks and Happy Flashing