3 Replies Latest reply on Aug 9, 2013 10:44 PM by kglad

    Class Breaking gotoAndStop


      I am making minesweeper.

      I have a Movie Clip with linkage name 'tile' which is dynamically attached in a 2D array.

      I have a class called 'tileClass' allowing me to define properties such as ._mine and ._marked rather than using dynamic variables such as instance["mine"]. I like using the class because it is a bit neater. This is for a Year 12 major projects so it also demonstrates a broader depth of knowledge.

      My issue is that when I assign the 'tileClass' to the 'tile' Movie Clip in the library, I am no longer able to use the command 'gotoAndStop' on the tile movie clip. I use it to change between the sprites of the tile (eg. pressed, numbers, flagged). When the class is taken off I can change frames, if it is assigned, I can not. It has no errors, simply does not change the frame.

      This is the class file (.as).

      class tileClass{

           var _mine:Boolean;

           var _revealed:Boolean;

           var _marked:Boolean;

           var _surround:Number;

           var _xcor:Number;

           var _ycor:Number;

           function tileClass() {

                _mine = false;

                _revealed = false;

                _marked = false;

                _surround = 0;



      This is the place where I am trying to change frames

      while(mineCount<(mines+1)) {

           randomNumber = Math.round(Math.random()* ((tilesDown * tilesAcross) - 1));

           tempX = randomNumber % tilesAcross; tempY = Math.floor(randomNumber / tilesAcross);

           if(_root["tile" + tempX + "_" + tempY]._mine == false) {

                _root["tile" + tempX + "_" + tempY].gotoAndStop(2);

                _root["tile" + tempX + "_" + tempY]._mine = true;

                trace("Mine: (" + tempX + "," + tempY + ") " + _root["tile" + tempX + "_" + tempY]); mineCount++;



      Any help is greatly appreciated, I have tried to find someone else with this issue and a solution but am so far unsuccessful.