Flash CS3 ドキュメンテーション |
|||
| ActionScript 2.0 リファレンスガイド > ActionScript クラス > Object > __proto__ (Object.__proto__ プロパティ) | |||
public __proto__ : Object
オブジェクトの作成に使用された、クラスの prototype プロパティ (ActionScript 2.0) またはコンストラクタ関数 (ActionScript 1.0) を参照します。__proto__ プロパティは、作成したすべてのオブジェクトに自動的に割り当てられます。ActionScript インタプリタは、__proto__ プロパティを使用してオブジェクトのクラスまたはコンストラクタ関数の prototype プロパティにアクセスし、オブジェクトがそのスーパークラスから継承しているプロパティとメソッドを確認します。
対応バージョン : ActionScript 1.0、Flash Player 5
次の例では、Shape という名前のクラスと Circle という名前の Shape のスーパークラスを作成します。
// Shape class defined in external file named Shape.as
class Shape {
function Shape() {}
}
// Circle class defined in external file named Circle.as
class Circle extends Shape{
function Circle() {}
}
Circle クラスを使用して、Circle の 2 つのインスタンスを作成できます。
var oneCircle:Circle = new Circle(); var twoCircle:Circle = new Circle();
次の trace ステートメントでは、両方のインスタンスの __proto_ プロパティが Circle クラスの prototype プロパティを参照していることを示します。
trace(Circle.prototype == oneCircle.__proto__); // Output: true trace(Circle.prototype == twoCircle.__proto__); // Output: true
prototype (Object.prototype プロパティ)
このページに新しいコメントが追加された場合に、電子メールでの通知を希望する。 | コメントレポート
現在のページ: http://livedocs.adobe.com/flash/9.0_jp/main/00002042.html