コンパイラで不正なコードが検出された場合に生成されるコンパイルエラーのリストを次に示します。これらのエラーの一部は、strict モードでコードをコンパイルする場合にのみ検出されます。strict モードには、標準の言語にはない次の 3 つの制約があります。

関連項目

Compiler Warnings
Run-Time Errors

 コードメッセージ説明
 1000 _ への参照があいまいです。 A reference might be to more than one item. For example, the following uses the namespaces rss and xml, each of which returns a different value for the hello() function. The trace (hello()) statement returns this error because it cannot determine which namespace to use.
private namespace rss;
	private namespace xml;
        
	public function ErrorExamples() {
  	    use namespace rss;
   	    use namespace xml;
	    trace(hello());
	}
        
   	rss function hello():String {
      	    return "hola";
        }
        
        xml function hello():String {
            return "foo";
        }

Correct an ambiguous reference by making the reference specific. The following example uses the form namespace::function to specify which namespace to use:

public function ErrorExamples() {
            
            trace(rss::hello());
            trace(xml::hello());
        }
 1003名前空間の属性にはアクセス指定子を使用できません。 
 1004名前空間が見つからないか、コンパイル時定数ではありません。 
 1006super 式はクラスインスタンスのメソッド内でのみ使用できます。 
 1007 super 式はクラスインスタンスのコンストラクタ内でのみ使用できます。 You cannot use the super statement within static members. You can use the super statement only within class instances.
 1008属性が無効です。 
 1010 override 属性はクラスプロパティの定義でのみ使用できます。 You cannot use the override keyword within a function block.
 1011 virtual 属性はクラスプロパティの定義でのみ使用できます。 You cannot use the virtual attribute when you declare a property that does not belong to a class (for example, when you declare a variable within a function block).
 1012static 属性はクラス内の定義でのみ使用できます。 
 1013private 属性はクラスプロパティの定義でのみ使用できます。 
 1014 intrinsic 属性はサポートされていません。 ActionScript 3.0 は intrinsic キーワードをサポートしていません。
 1016 基本クラスは final です。 The superclass cannot be extended because it is marked as final.
 1017基本クラス _ の定義が見つかりませんでした。 
 1018クラス定義が重複しています :_。 
 1020override としてマークされたメソッドは、別のメソッドをオーバーライドする必要があります。 
 1021 関数の定義が重複しています。 同じスコープ内で同じ識別子名を持つ関数を複数宣言することはできません。
 1022final アクセサをオーバーライドすることはできません。 
 1023オーバーライドに対応していません。 
 1024 オーバーライドに対応していない関数をオーバーライドしています。 If a method in a class overrides a method in a base class, you must explicitly declare it by using the override attribute, as this example shows:
public override function foo():void{};
 1025 最後のメソッドを再定義することはできません。 The method cannot be extended because it is marked as final in the base class.
 1026コンストラクタ関数はインスタンスメソッドでなければなりません。 
 1027関数を同時に static および override として設定することはできません。 
 1028関数を同時に static および virtual として設定することはできません。 
 1029関数を同時に final および virtual として設定することはできません。 
 1030 変数の引数配列の名前を指定する必要があります。 The ...(rest) parameter definition specifies that all values supplied after ...(rest) are collected into any array. You must specify a name for the array, as in the expression function foo(x,...(rest)).
 1033仮想変数はサポートされていません。 
 1034変数がネイティブであることはできません。 
 1035変数を同時に final および virtual として設定することはできません。 
 1036static キーワードをクラス定義外で使用することはできません。 
 1037パッケージをネストすることはできません。 
 1038break ステートメントのターゲットが見つかりませんでした。 
 1039continue ステートメントのターゲットが見つかりませんでした。 
 1040ラベルの定義が重複しています。 
 1041属性は呼び出し可能ではありません。 
 1042 this キーワードは静的メソッドで使用できません。このキーワードはインスタンスのメソッド、関数閉包、グローバルコード内でのみ使用できます。 You cannot use the this keyword within a static member, because this would have no context.
 1043名前空間が未定義です。 
 1044インターフェイスメソッド _ (名前空間 _) はクラス _ によって実装されません。 
 1045インターフェイス _ が見つかりませんでした。 
 1046 型が見つからないか、コンパイル時定数ではありません : _。 The class used as a type declaration cannot be found. Check that you are importing the correct class, and that its package location has not changed. Also, check that the package that contains the code (not the imported class) is defined correctly. (for example, make sure to use proper ActionScript 3.0 package syntax, and not ActionScript 2.0 syntax.)

The error can also occur if the class being referenced is not defined in a namespace that is in use or is not defined as public:

public class Foo{}

If you are using FlexBuilder 2.0 and the class is in a library, make sure to set the class path for the project.

 1047パラメータ初期化子が不明か、コンパイル時定数ではありません。 
 1048メソッドをコンストラクタとして使用することはできません。 
 1049定数として指定した変数への代入が無効です。 
 1050参照値以外の代入はできません。 
 1051 戻り値は未定義でなければなりません。 You are attempting to use the return statement within a method that has the return type void.
 1052 定数初期化子が不明か、コンパイル時定数ではありません。 The value used to initialize the constant is either undefined or could have different values at run time. Check that the initializer is spelled correctly, and that the initializer value isn't an expression that could result in different possible values at run time.
 1053アクセサの型が一致している必要があります。 
 1054 setter 定義の戻り型は未指定または void でなければなりません。 You cannot specify a return value for a setter function. For example, the following is invalid:
public function set gamma(g:Number):Number;

The following is valid:

public function set gamma(g:Number):void;
 1058プロパティは書き込み専用です。 
 1059 プロパティは読み取り専用です。 This property is defined through a getter function, which allows you to retrieve that property's value. There is no setter function defined for this property, however, so it is read-only.

In the following example, line 3 generates an error because there is no setter function defined for xx:

class D { function get xx() { return 22; } }
	var d:D = new D();
	d.xx = 44; // error, property is read-only
 1061 未定義である可能性のあるメソッド _ を、静的型 _ の参照を使用して呼び出しました。 You are calling a method that is not defined.
 1063ファイルを開けません :_。 
 1064 メタデータが無効です。 This metadata is unrecognized.
 1065メタデータ属性が複数のエレメントを持つことはできません。 
 1067 型 _ の値が、関連しない型 _ に暗黙で型変換されています。 You are attempting to cast an object to a type to which it cannot be converted. This can happen if the class you are casting to is not in the inheritance chain of the object being cast. This error appears only when the compiler is running in strict mode.
 1068付属ファイルを開けません : _。 
 1069 シンタックスエラー : 定義またはディレクティブが必要です。 行のシンタックスを確認してください。
 1070 属性の後にブロックステートメントが必要です。 行のシンタックスを確認してください。
 1071 シンタックスエラー : 属性 _ の後には、_ ではなく定義キーワード (関数など) が必要です。 This error might occur when the compiler encounters an unexpected character. For example, the following use of the trace() function is invalid, because of the missing parentheses (the correct syntax is trace("hello")):
import flash.util.trace;
                 trace "hello"
 1072 シンタックスエラー : namespace の前に xml が必要です。 The correct statement syntax is default xml namespace = ns. Either the keyword xml (note the lowercase) is missing or an incorrect keyword was used. For more information, see the default xml namespace directive.
 1073シンタックスエラー : catch 節または finally 節が必要です。 
 1075シンタックスエラー : 'each' キーワードを 'in' 演算子なしで使用することはできません。 
 1076シンタックスエラー : 識別子の前に左括弧が必要です。 
 1077 CaseLabel が必要です。 The compiler expected a case statement at this point in the switch block. The following switch block correctly includes a case statement:
switch(x)
	{
	print(2);
	case 0:  print(0); 
	break
	}
 1078ラベルは単純な識別子でなければなりません。 
 1079super 式には 1 つのオペランドが必要です。 
 1080インクリメント演算子またはデクリメント演算子が必要です。 
 1082括弧内に 1 つの式が必要です。 
 1083 シンタックスエラー : _ は不要です。 The line of code is missing some information. In the following example, some expression (such as another number) needs to be included after the final plus sign:
var sum:int = 1 + 2 + ;
 1084 シンタックスエラー : _ が _ の前に必要です。 If the error says "Expecting right brace before end of program," a block of code is missing a closing brace (}).

If the error says "Expecting left parenthesis before _," you may have omitted a parenthesis from a conditional expression, as shown here in this example which is intentionally incorrect:

var fact:int = 1 * 2 * 3;
if fact > 2 {
	var bigger:Boolean = true;
}
 1086シンタックスエラー : _ の前にセミコロンが必要です。 
 1087シンタックスエラー : プログラムの末尾の後に余分な文字が見つかりました。 
 1093シンタックスエラー。 
 1094シンタックスエラー : ストリングリテラルは改行の前に終了する必要があります。 
 1095シンタックスエラー : ストリングリテラルは改行の前に終了する必要があります。 
 1096ストリングリテラル内ではバックスラッシュ文字を使用できません。 
 1097シンタックスエラー : ストリングリテラルを閉じる引用符に達する前に入力が終了しました。 
 109810 進数に 10 進数以外の識別子文字を含めることはできません。 
 1099シンタックスエラー。 
 1100シンタックスエラー : XML の開始タグと終了タグが一致していません。 
 1101ストリングリテラル内にバックスラッシュが見つかりました。 
 1102super の子孫を削除することはできません。 
 1103 名前空間の定義が重複しています。 You defined the namespace more than once. Delete or modify the duplicate definition.
 1104_ 
 1105 代入のターゲットは参照値でなければなりません。 You can assign a value to a variable, but you cannot assign a value to another value.
 1106 インクリメントのオペランドは参照でなければなりません。 The operand must be a variable, an element in an array, or a property of an object.
 1107 インクリメントのオペランドが無効です。 The operand must be a variable, an element in an array, or a property of an object.
 1108 デクリメントのオペランドが無効です。 The operand must be a variable, an element in an array, or a property of an object.
 1109 式が必要です。 An expression is missing in a part of the code. For example, the following produces this error (there is a condition missing from the if statement:
if () {
	var x:int = 4;
}
 1110XML タグ名が見つかりません。 
 1111ファイル _ は有効な ABC ファイルではありません。 
 1112 このファイルインクルードにより、無限再帰の可能性があります : _。 A file that is included in the source being compiled contains other include statements that would cause an infinite loop. For example, the following files. a.as and b.as, generate this error because each file tries to include the other.

File a.as contains the following, which attempts to include the file b.as:

import foo.bar.baz;
	include "b.as"
	print(2);

File b.as contains the following, which attempts to include the file a.as:

include "a.as"
 1113 _ で循環型参照が検出されました。 A class is trying to extend a superclass. For example, class A cannot extend class B if B inherits from A:
class a extends b { }
	class b extends a { }
 1114public 属性はパッケージ内でのみ使用できます。 
 1115internal 属性はパッケージ内でのみ使用できます。 
 1116ユーザー定義の名前空間の属性は、クラス定義のトップレベルでのみ使用できます。 
 1118 静的型 _ の値が、関連しない可能性が高い型 _ に暗黙で型変換されています。 You are using a value that is not of the expected type and no implicit coercion exists to convert it to the expected type.

You are using a supertype where a subtype is expected. For example, the following generates this error because it creates class A and then creates class B, which in turn extends class A:

class A {}
	var a:A = new A(); 
	class B extends A { function f() }
	var b : B = a // error

The last statement generates an error because it attempts to assign an object of type B to a variable of type A.

Similarly, the following defines the foo() function, which takes a parameter of type B. The statement foo(a); generates an error because it attempts to use a parameter of type A:

function foo(x:B) { }
	foo(a);

Also, the following statement generates an error because the returned value for foo2() must be type B:

function foo2():B { return new A(); }
 1119 未定義である可能性が高いプロパティ _ に静的型 _ の参照を使用してアクセスしています。 You are attempting to access a property that does not exist for the specified object. For example, the following code generates this error because an int object does not have a property named assortment:
var i:int = 44;
var str:String = i.assortment;
This error appears only when the compiler is running in strict mode.
 1120 未定義のプロパティ _ へのアクセスです。 You are attempting to access an undefined variable. For example, if the variable huh has not been defined, a call to it generates this error:
huh = 55;
This error can only appear when the compiler is running in strict mode.
 1121getter 定義にはパラメータを使用できません。 
 1122setter 定義には 1 つのパラメータが必要です。 
 1123setter 定義には任意指定のパラメータを使用できません。 
 1124 getter 定義の戻り型は void 以外でなければなりません。 A getter function simulates a variable. Because variables cannot be of type void, you cannot declare getter functions to return type void.
 1125インターフェイスで定義されたメソッドにボディを含めることはできません。 
 1126関数にボディを含めることはできません。 
 1127 属性 _ は複数回指定されています。 You specified an attribute more than once in the same statement. For example, the statement public static public var x; generates this error because it specifies that the variable x is public twice. Delete duplicate declarations.
 1129 インターフェイス定義が重複しています : _。 Change or delete the duplicate definitions.
 1130コンストラクタは戻り型を指定できません。 
 1131クラスをネストすることはできません。 
 1132final 属性はクラス内で定義されたメソッドでのみ使用できます。 
 1133native 属性は関数定義でのみ使用できます。 
 1134dynamic 属性はクラス定義でのみ使用できます。 
 1135シンタックスエラー : _ は有効なタイプではありません。 
 1136 引数の数が正しくありません。正しくは _ です。 The function expects a different number of arguments than those you provided. For example, the following defines function goo, which has two arguments:
class A { static function goo(x:int,y:int) 
	{ return(x+y); } }

The following statement would generate an error because it provides three arguments:

A.goo(1,2,3);
 1137引数の数が正しくありません。_ 個以下であることが必要です。 
 1138必須パラメータを任意パラメータの後に指定することはできません。 
 1139インターフェイスでは変数の宣言が許可されていません。 
 1140...残りパラメータ定義のキーワードの後に指定したパラメータで使用できるのは、Array データ型のみです。 
 1141クラスが拡張できるのは別のクラスのみです。インターフェイスを拡張することはできません。 
 1142 インターフェイスが拡張できるのは別のインターフェイスのみです。_ はクラスです。 You are attempting to have the interface extend a class. An interface can only extend another interface.
 1143override 属性はクラス内で定義されたメソッドでのみ使用できます。 
 1144 インターフェイスメソッド _ (名前空間 _) は、対応していないシグネチャでクラス _ に実装されています。 Method signatures must match exactly.
 1145 ネイティブなメソッドにボディを含めることはできません。 You cannot use native because it is a reserved keyword.
 1146コンストラクタは getter メソッドまたは setter メソッド以外でなければなりません。 
 1147AS ソースファイルが指定されていません。 
 1149return ステートメントを static 初期化コードで使用することはできません。 
 1150protected 属性はクラスプロパティの定義でのみ使用できます。 
 1151 定義 _ (名前空間 _) にコンフリクトが存在します。 You cannot declare more than one variable with the same identifier name within the same scope unless all such variables are declared to be of the same type. In ActionScript 3.0, different code blocks (such as those used in two for loops in the same function definition) are considered to be in the same scope.

The following code example correctly casts the variable x as the same type:

function test()
	{
	var x:int = 3;
	for(var x:int = 33; x < 55; x++)
	print(x);
	for(var x:int = 11; x < 33; x++)
	print(x)
	}

The following code example generates an error because the type casting in the variable declaration and the for loops are different:

function test()
	{
var x:String = "The answer is";
for(var x:int = 33; x < 55; x++) // error
print(x);
for(var x:unit = 11; x < 33; x++) // error
print(x)
}
 1152継承した定義 _ (名前空間 _) にコンフリクトが存在します。 
 1153コンストラクタは public としてのみ宣言できます。 
 1154定義には、public、private、protected、または internal のいずれか 1 つのみを指定できます。 
 1155アクセサを他の関数内にネストすることはできません。 
 1156インターフェイスを新しい演算子でインスタンス化することはできません。 
 1157インターフェイスのメンバーを public、private、protected、または internal として宣言することはできません。 
 1158シンタックスエラー : 関数ボディの前に左括弧 ({) がありません。 
 1159return ステートメントを package 初期化コードで使用することはできません。 
 1160 native 属性をインターフェイスの定義で使用することはできません。 You cannot use native because it is a reserved keyword.
 11621 つの定義に使用できる名前空間の属性は 1 つのみです。 
 1163メソッド _ は、インターフェイス _ から継承した定義とコンフリクトしています。 
 1165インターフェイスの属性 _ が無効です。 
 1166インターフェイスでは名前空間の宣言が許可されていません。 
 1167 クラス _ はインターフェイス _ を複数回実装しています。 The class implements the same interface more than once. For example, the following generates this error because class C implements interface A twice:
interface A {  public function f();  };
  	  class C implements A,A {
		public function f() { print("f"); }
  	}

The correct implementing statement should be class C implements A {.

 1168 関数 _ への代入が不正です。 You are attempting to redefine a function. For example, the following defines the function topLevel() to print the word "top". The second statement generates an error because it assigns a different return value to the function:
function topLevel() { print("top"); }
	topLevel = function() { print("replacement works in ~");
	} // error
 1169インターフェイスのメソッドでは名前空間の属性が許可されていません。 
 1170 関数は値を返しません。 Every possible control flow in a function must return a value whenever the return type is something other than void. The following function f(x) does not generate an error because the if..else statement always returns a value:
function f(x):int
	{
 	if (x)
    	  return 2;
 	else
    	  return 3;
	} // no error

However, the function g(x) below generates the error because the switch statement does not always return a value.

function g(x:int):int
	{
   	switch(x)
   	{
      	  case 1: return 1;
      	  case 2: return 2:
   	}
	// return 2;//uncomment to remove the error
	}

This checking is enabled only when the function declares a return type other than void.

 1171名前空間の初期化子は、リテラルストリングまたは別の名前空間でなければなりません。 
 1172定義 _ が見つかりません。 
 1173ラベルの定義が無効です。 
 1176静的型 _ の値と、関連しない可能性が高い型 _ の値とを比較しています。 
 1177return ステートメントを global 初期化コードで使用することはできません。 
 1178アクセスできないプロパティ _ へのアクセスを、静的型 _ の参照を使用して試行しました。 
 1180未定義である可能性が高いメソッド _ の呼び出しです。 
 1181参照を基本クラス _ に送ります。 
 1182パッケージを値として使用することはできません : _。 
 1184対応していない型 _ のデフォルト値です。_ が必要です。 
 1185switch には 1 つ以上のデフォルトがありますが、デフォルトは 1 つでなければなりません。 
 1186プロトタイプ変数の定義で許可される変数のバインディングは 1 つのみです。 
 1187プロトタイプの属性は、インスタンス変数の定義でのみ使用できます。 
 1188クラス _ への代入が無効です。 
 1189固定プロパティ _ を削除しようとしています。削除できるのは、動的に定義されたプロパティだけです。 
 1190基本クラスが見つからないか、コンパイル時定数ではありません。 
 1191インターフェイスが見つからないか、コンパイル時定数ではありません。 
 1192static 属性を名前空間の定義で使用することはできません。 
 1193インターフェイスの定義をクラスまたは他のインターフェイスの定義内にネストすることはできません。 
 1194プロトタイプの属性が無効です。 
 1195 アクセスできないメソッド _ へのアクセスを、静的型 _ の参照を使用して試行しました。 You are calling a private method from another class.
 1196シンタックスエラー : throw の後には式が必要です。 
 1197クラス _ は _ を拡張できません。これらは両方ともライブラリのシンボルまたはメインタイムラインに関連付けられているからです。 
 1198属性はパッケージ定義で許可されていません。 
 1199内部エラー :_。 
 1200シンタックスエラー : 無効な for-in イニシャライザです。式は 1 つだけにしてください。 
 1201super ステートメントは、このステートメント、super ステートメント、return ステートメント、または throw ステートメントの後に続けることはできません。 
 1202パッケージ _ 内の未定義のプロパティ _ へのアクセスです。 
 1203基本クラス _ にデフォルトコンストラクタがありません。 You must explicitly call the constructor of the baseclass with a super() statement if it has 1 or more required arguments.
 1204対応する */ がない /* が見つかりました。