Thanks to Aaron I have added another solution to AS3 Error 1084 that deals with using numeric characters. Check out the fix for ActionScript Error 1084.
Thanks and as always,
Happy Flashing
Curtis J. Morley
Thanks to Aaron I have added another solution to AS3 Error 1084 that deals with using numeric characters. Check out the fix for ActionScript Error 1084.
Thanks and as always,
Happy Flashing
Curtis J. Morley
ActionScript Error #1084: Syntax error: expecting rightbrace before end of program.
Error 1084 is the general error number for syntax errors. ActionScript Error #1084 can be any number of errors. I will keep this one up to date with all the variations I find and how to fix them.
AS3 Error 1084: Syntax error: expecting rightbrace before end of program
This is a very easy one. This error just means that you are most likely missing a right brace. Or you have nested code improperly.
Bad Code:
package com.cjm
{
class CoolClass {
function CoolClass () {
trace(“Something cool”)
}
}
Good Code:
package com.cjm
{
class CoolClass {
function CoolClass () {
trace(“Something cool”)
}
}
}
Please make note of the third bracket at the end of the good code.
ActionScript Error #1084: Syntax error: expecting colon before semicolon.
You will most likely get this error if you are using a ternary statement and you forget to use a colon, forgot the last part of your ternary, or you replace the colon with a semicolon. This is illustrated in the following example:
Bad Code:
me.myType == “keys” ? trace(keys);
or
me.myType == “keys” ? trace(keys) ; trace(defs);
Good Code:
me.myType == “keys” ? trace(keys) : trace(defs);
Flash/Flex Error #1084: Syntax error: expecting identifier before leftbrace.
Description:
This Flash/Flex Error is reported when you left out the name of your class. The ‘identifier‘ that it is looking for is the name of your class.
Fix:
You will see in the code below that you just need to add in the name of your class and the error will go away.
Bad Code:
package com.cjm.somepackage {
public class {
}
}
Good Code:
package com.cjm.somepackage {
public class MyClass {
}
}
Flex/Flash Error #1084: Syntax error: expecting leftparen before colon.
or
Flex/Flash Error #1084: Syntax error: expecting rightparen before colon.
Description:
These AS3 Errors are reported when you the order of the parenthesis and colon are not in the proper place or the parenthesis is missing.
Fix:
The AS3 code below demonstrates the placement error. Properly order the items and the error will disappear. Also, make sure that a parenthesis is not missing. The ‘Bad Code’ gives an example of leftParen and then right paren in the order.
Bad Code:
public function ScrambleSpelling:void (s:String)
or
public function ScrambleSpelling(s:String:void
Good Code:
public function ScrambleSpelling (s:String):void
Flex/Flash Error #1084: Syntax error: expecting rightparen before semicolon.
Description:
This AS3 Error is reported most often when the parenthesis is missing.
Fix:
Make sure that a parenthesis is not missing. The ‘Bad Code’ gives an example of leftParen and then right paren in the order.
Bad Code:
tempArray.push((middle.splice(middle.length-1) * Math.random());
or
tempArray.push(middle.splice(middle.length-1) * Math.random();
Good Code:
tempArray.push(middle.splice(middle.length-1) * Math.random());
Flex/Flash Error #1084: Syntax error: expecting identifier before 1084.
Description:
This AS3 Error is reported when you have begun a package, class, function/method or variable with a numeric character rather than an Alpha character, _(underscore), or $(dollar sign). In the Flash Authoring environment it won’t allow you to add numerics as the first character in an instance name or in the linkage but with code it just gives this crazy error.
Fix:
Make sure to name your package, class, function/method or variable with a Alpha character, _(underscore), or $(dollar sign).
Bad Code:
package 1084_error
{
class 1084_error {
function 1084_error () {
var 1084_error:int = 123;
}
}
}
Good Code:
package error_1084
{
class error_1084 {
function error_1084 () {
var error_1084:int = 123;
}
}
}
P.S. It is probably not a good idea to give everything the same name as in the examples above.
AS3 Error #1084 will rear it’s many heads according to the particular syntax error at the moment. I will post every variation of this error that I can find.
Once again Happy Flashing