0

これは、プレーヤーの幅の半分を見つけるために public クラスにあります。

   public class Player extends MovieClip
{    
   private var playerHalfWidth:int = this.width/2;

次のエラーが表示されます。

1119:Access of possibly undefined property width through a 
reference with static type class
4

1 に答える 1

0

Playerオブジェクトが作成さthisれる前でも参照しようとしています。

それをコンストラクターに移動するのが正しい方法です:

public class Player extends MovieClip {

   private var playerHalfWidth:int;

   public function Player() {

     playerHalfWidth = this.width/2;
   }
于 2012-12-29T10:43:18.580 に答える