Flex / Flash Error 1137

ActionScript Error #1137: Incorrect number of arguments. Expected no more than 0.

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

Flash Error 1137 Fix:
Remove all parameters from within the parenthesis.

Bad Code:

var fileToLoad:URLRequest = new URLRequest(“cleanhandsworkahsc.swf”)
var myLoader:Loader = new Loader(fileToLoad);
this.addChild(myLoader);

Good Code:

var fileToLoad:URLRequest = new URLRequest(“cleanhandsworkahsc.swf”)
var myLoader:Loader = new Loader();
myLoader.load(fileToLoad);
this.addChild(myLoader);

This should help you resolve Flex / Flash Error #1137

Thanks and as always Happy Flashing

Curtis J. Morley

ActionScript Error #1024

ActionScript Error #1024: Overriding a function that is not marked for override.

Description:
AS3 error 1024 means that Flash or Flex already has a function by that name.

Fix:
To solve Flex/Flash Error 1024 all you need to do is either correctly name the function something besides a reserved function in Flex/Flash or properly override the function. The example below shows how to solve issue number one. Notice that the good code solves Error 1024 because it doesn’t use the same name as a function that already exists in ActionScript.

Bad Code 1:

function nextFrame (e:MouseEvent):void
{
this.nextFrame();
}

Good Code 1:

function onNextFrame (e:MouseEvent):void
{
this.nextFrame();
}

This should help you resolve Flash / Flex Error #1024

Thanks and as always Happy Flashing

Curtis J. Morley

Flex 2 / Flash CS3 ActionScript Error #1105

ActionScript Error #1105: Target of assignment must be a reference value.

Description:
This ActionScript error simply means that you are trying to assign a value to something that is already a value and not a variable or a writable property. Adobe Live Docs actually has a pretty good definition about this one. It says, ” You can assign a value to a variable, but you cannot assign a value to another value.” To make this simple let me use an example. An array has a property length. An XMLList also has a property called length() . Pay attention to the parenthesis. An array will let you change the length of the array simply by calling my_array.length = 2; because it is a readable and writable property. When using XML however the length property is only readable so my_xml.length() = 0; is like saying 2 = 0; You can not change the value 2.

Fix:
When you get this ActionScript error make sure to check that you are not trying to change a value. Also make sure that the property is readable and writable.

Bad Code:

my_xml.children().length() = 0;

Good Code:

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

Good luck trouble shooting ActionScript Error #1105 and,
As always Happy Flashing

ActionScript Error #2032

ActionScript Error #2032: Stream Error. URL: /Sound/Amazing.mp3

Description:
This is an ActionScript Runtime Error that you will get if you purposefully trap errors (which I highly recommend you do) while trying to load a file into Flash/Flex. One very simple reason you will get this error is if you have targeted an mp3 or any file incorrectly. This can include php scripts and other external datasources.

Fix:
Make sure that you are targeting the file correctly. In the ‘Bad Code’ example below I am missing just one letter. Without trapping the errors like I do you will also get AS3 Error #2044: Unhandled IOError Event

Bad Code:

private var snd:Sound = new Sound();
snd.load(new URLRequest(“Amzing.mp3”));
snd.addEventListener(IOErrorEvent.IO_ERROR, onSoundIOError, false, 0, true);

function onSoundIOError (e:IOErrorEvent)
{
trace(“An Error Occured and it looked like this.”, e.text);
}
snd.play();

Good Code:

private var snd:Sound = new Sound();
snd.load(new URLRequest(“Amazing.mp3”));
snd.addEventListener(IOErrorEvent.IO_ERROR, onSoundIOError, false, 0, true);

function onSoundIOError (e:IOErrorEvent)
{
trace(“An Error Occured and it looked like this.”, e.text);
}
snd.play();

Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
at SoundControl_fla::MainTimeline/frame1()

Related ActionScript Errors – AS3 Error 2044 Unhandled IOError Event

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