Flash CS3 / Flex Error #2136: The SWF file file:///C|/Curtism/Flash/matchWordsGameTest.swf contains invalid data

#2136: The SWF file file:///C|/Curtism/Flash/myFile.swf contains invalid data.

Fun error that you get when compiling the swf with an external AS file as your ‘Document class’. Most Likely you will get this error if you are using a document class and also have code on your timeline.

Fix :

Remove the code from your timeline or remove the Document Class

As Always Happy Flashing

Flash/Flex AS3 Error #2007

Error #2007: Parameter text must be non-null.It is the error of the year Error 2007. This error is very ambiguous but is not hard to understand once you realize what it means.

This error means that you are trying to assign an object some text but you forget to target the text and instead you target the text field. In the bad example below ‘.text’ is forgotten. It is included in the Good Code

Bad Code:

for (var i:int = 0; i<15; i++) { array[i] = myText_txt;
}

Good Code:

for (var i:int = 0; i<15; i++) { array[i] = myText_txt.text;
}

And that is how you solve ActionScript Error #2007: Parameter text must be non-null.

As always Happy Flashing

Flash CS3 / Flex 2 Error #1084

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