2012-04-11 7 views
0

こんにちは私はエラーを取得し続けています。 on line 13。 ご協力いただきありがとうございました。ありがとうございます。AS2でスワミング

fly = function() { 
    this.animate = function() { 
     // Capture mouse positions and distance from mouse 
     this.targetX = _root._xmouse; 
     this.targetY = _root._ymouse; 
     this.distX = this.targetX-this.meX+this.flockX; 
     this.distY = this.targetY-this.meY+this.flockY; 
     // 
     if ((this.targetX == this.oldTargetX) && Math.random()>0.9) { 
      // add small scale random darting if mouse is still 
      this.flockX = (Math.random()*100)-50; 
      this.flockY = (Math.random()*100)-50; 
     } else if ((this.targetX<>this.oldTargetX) && Math.random()>0.8) { 
      // add large scale random darting if mouse is moving 
      this.flockX = (Math.random()*400)-200; 
      this.flockY = (Math.random()*400)-200; 
     } 
     // Apply inertia equation 
     this.meX = Math.round(this.meX+(this.distX)/20); 
     this.meY = Math.round(this.meY+(this.distY)/20); 
     // perform animation 
     this._x = this.meX; 
     this._y = this.meY; 
     // remember the current mouse pos so we can tell if 
     // it has moved next time around 
     this.oldTargetX = this.targetX; 
    }; 
    this.initialize = function() { 
     this.targetX = 0; 
     this.targetY = 0; 
     this.distX = 0; 
     this.distY = 0; 
     this.meX = this._x; 
     this.meY = this._y; 
     this.oldTargetX = 0; 
     this.flockX = (Math.random()*200)-100; 
     this.flockY = (Math.random()*200)-100; 
    }; 
    // set up onEnterFrame script to animate _parent... 
    this.initialize(); 
    this.onEnterFrame = this.animate; 
}; 
    // 
    // 
    var i:Number = 0; 
    var bugClip:MovieClip; 
    for (i=0; i<30; i++) { 
     bugClip = this.attachMovie("bug", "bug"+i, i); 
     fly.apply(bugClip); 
    } 
+0

あなたはコードブロック内のコードを編集する必要があります。そうでなければ誰もあなたの質問に答えません。 – JGilmartin

+1

@StudentRikあなたの質問は変更されました(stackoverflowでコードをフォーマットするために{}記号を使用します)コードは明らかにAS2です。私はこのエラーによって引き起こされたと考えます: 'this.targetX <> this.oldTargetX'。これは間違いですか(それは< or >であるべきですか)、あるいは 'different'/'not equal'を意味しますか?その場合、 '!'(NOT)演算子を使うべきです: 'this.targetX!= this.oldTargetX' –

答えて

0

私は、ActionScriptについては知らないが、あなたのコードを見て、私はこのようにやってお勧めします:等しくないため

randomValue = Math.random() 
    if ((this.targetX == this.oldTargetX) && randomValue>0.9) { 
0

<>演算子は、Flash Player 5 Doc reference here以降廃止されました

同じ機能を使用するには、!=を使用する必要があります。

私はこれをFlash Player 10.2でテストしましたが、エラーなしでコンパイルして実行します。私はあなたが後のバージョンにコンパイルしていると思います。