actionscript 3 - Flash AS3 Error: Line 48 1013: The private attribute may be used only on class property definitions -


i'm beginner of flash as3. i'm trying create game in beginning of game project. error comes. error --> line 48: 1013: private attribute may used on class property definitions. don't know problem, else know problem if know please tell me. code:

package  {     import flash.display.sprite;     import flash.events.mouseevent;     public class main extends sprite     {          public function main()         {             // variables , constants             const number_of_tiles:uint = 20;             const tiles_per_row:uint = 5;             var tiles:array=new array();             var tile:tile_movieclip;              // end of variables , constants             (var i:uint=0; i<number_of_tiles; i++)             {                 tiles.push(math.floor(i/2));                 trace("my tiles: "+tiles);                 // end of tiles creation loop                  // end of tiles creation loop add following code:                 // shuffling loop                 var swap,tmp:uint;                 (i=number_of_tiles-1; i>0; i--)                 {                     swap = math.floor(math.random() * i);                     tmp = tiles[i];                     tiles[i] = tiles[swap];                     tiles[swap] = tmp;                     trace("my shuffled tiles: "+tiles);                     // end of shuffling loop                      //tile placing loop                     (i=0; i<number_of_tiles; i++)                     {                         tile=new tile_movieclip();                         addchild(tile);                         tile.cardtype = tiles[i];                         tile.x=5+(tile.width+5)*(i%tiles_per_row);                         tile.y=5+(tile.height+5)*    (math.floor(i/tiles_per_row));                         tile.gotoandstop(number_of_tiles/2+1);                         tile.buttonmode = true;                         tile.addeventlistener(mouseevent.click, ontileclicked);                         // end of tile placing loop                      }                         private function ontileclicked(e:mouseevent) {                      trace("you picked "+e.currenttarget.cardtype);                      e.currenttarget.gotoandstop(e.currenttarget.cardtype+1);                  }              }          }     } } 

}

your private function ontileclicked inside main method. access modifiers have used @ class level (the same level main method), not inside other methods.

you should either remove private modifier, or move function class level. is, function can't accessed outside main, doesn't need private.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -