actionscript 1 to actionscript 2

  • joeyd69
  • Born
  • Born
  • joeyd69
  • Posts: 2

Post 3+ Months Ago

i have created this flash file in flash 5, however i recently purchased flash mx and now as it uses actionscript 2.0 my game will not play.

can anyone help me convert my actionscript 1.0 script into actionscript 2.0 script

Code: [ Select ]
boardxoffset = 0;
boardyoffset = 25;
tilewidth = 35;
tileheight= 35;

board = new Array();
board[0] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
board[1] = new Array(1, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 2, 0, 1);
board[2] = new Array(1, 2, 2, 2, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 1);
board[3] = new Array(1, 0, 0, 0, 0, 0, 2, 0, 2, 0, 2, 0, 0, 0, 1);
board[4] = new Array(1, 0, 2, 0, 2, 0, 2, 0, 0, 0, 2, 2, 2, 0, 1);
board[5] = new Array(1, 0, 2, 0, 2, 0, 2, 0, 2, 0, 0, 0, 0, 0, 1);
board[6] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 2, 2, 0, 1);
board[7] = new Array(1, 2, 2, 2, 0, 2, 2, 2, 2, 0, 0, 0, 2, 0, 1);
board[8] = new Array(1, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 2, 2, 0, 1);
board[9] = new Array(1, 0, 2, 2, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 1);
board[10] = new Array(1, 0, 2, 0, 0, 2, 2, 2, 0, 2, 2, 0, 2, 0, 1);
board[11] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1);
board[12] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);

level = 10;
for (row = 0; row < board.length; row++) {
    for (col = 0; col < board[row].length; col++) {
        if (board[row][col] > 0) {
            duplicateMovieClip ("tile" add board[row][col], "tile" add row add "_" add col, level++);
            this["tile" add row add "_" add col]._x = (col * tilewidth) + boardxoffset;
            this["tile" add row add "_" add col]._y = (row * tileheight) + boardyoffset;
        }
    }
}


things = new Array();
things[0] = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
things[1] = new Array(0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0);
things[2] = new Array(0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0);
things[3] = new Array(0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0);
things[4] = new Array(0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0);
things[5] = new Array(0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0);
things[6] = new Array(0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0);
things[7] = new Array(0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0);
things[8] = new Array(0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0);
things[9] = new Array(0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0);
things[10] = new Array(0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0);
things[11] = new Array(0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0);
things[12] = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
targetscore = 90;

for (row = 0; row < things.length; row++) {
    for (col = 0; col < things[row].length; col++) {
        if (things[row][col] > 0) {
            duplicateMovieClip ("thing" add things[row][col], "thing" add row add "_" add col, level++);
            this["thing" add row add "_" add col]._x = (col * tilewidth) + boardxoffset;
            this["thing" add row add "_" add col]._y = (row * tileheight) + boardyoffset;
        }
    }
}

ghostStartCol = 13;        
ghostStartRow = 1;        
ghostSpeed = 4;            
numGhosts = 4;            


ghostColPositions = new Array();
ghostRowPositions = new Array();


for (num = 0; num < numGhosts; num++) {
    duplicateMovieClip("ghost", "ghost" add num, level++);
    ghostColPositions[num] = ghostStartCol;
    ghostRowPositions[num] = ghostStartRow;
    this["ghost"add num]._x = (ghostColPositions[num] * tilewidth) + boardxoffset;
    this["ghost"add num]._y = (ghostRowPositions[num] * tileheight) + boardyoffset;
}

martynCol = 1;
martynRow = 1;
martynScore = 0;
martynLives = 3;
martynSpeed = 4;
martynWalking = 0;

duplicateMovieClip("martynRight", "martyn", level++);
martyn._x = martynCol * tilewidth + boardxoffset;
martyn._y = martynRow * tileheight + boardyoffset;
  1. boardxoffset = 0;
  2. boardyoffset = 25;
  3. tilewidth = 35;
  4. tileheight= 35;
  5. board = new Array();
  6. board[0] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
  7. board[1] = new Array(1, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 2, 0, 1);
  8. board[2] = new Array(1, 2, 2, 2, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 1);
  9. board[3] = new Array(1, 0, 0, 0, 0, 0, 2, 0, 2, 0, 2, 0, 0, 0, 1);
  10. board[4] = new Array(1, 0, 2, 0, 2, 0, 2, 0, 0, 0, 2, 2, 2, 0, 1);
  11. board[5] = new Array(1, 0, 2, 0, 2, 0, 2, 0, 2, 0, 0, 0, 0, 0, 1);
  12. board[6] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 2, 2, 0, 1);
  13. board[7] = new Array(1, 2, 2, 2, 0, 2, 2, 2, 2, 0, 0, 0, 2, 0, 1);
  14. board[8] = new Array(1, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 2, 2, 0, 1);
  15. board[9] = new Array(1, 0, 2, 2, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 1);
  16. board[10] = new Array(1, 0, 2, 0, 0, 2, 2, 2, 0, 2, 2, 0, 2, 0, 1);
  17. board[11] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1);
  18. board[12] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
  19. level = 10;
  20. for (row = 0; row < board.length; row++) {
  21.     for (col = 0; col < board[row].length; col++) {
  22.         if (board[row][col] > 0) {
  23.             duplicateMovieClip ("tile" add board[row][col], "tile" add row add "_" add col, level++);
  24.             this["tile" add row add "_" add col]._x = (col * tilewidth) + boardxoffset;
  25.             this["tile" add row add "_" add col]._y = (row * tileheight) + boardyoffset;
  26.         }
  27.     }
  28. }
  29. things = new Array();
  30. things[0] = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  31. things[1] = new Array(0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0);
  32. things[2] = new Array(0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0);
  33. things[3] = new Array(0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0);
  34. things[4] = new Array(0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0);
  35. things[5] = new Array(0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0);
  36. things[6] = new Array(0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0);
  37. things[7] = new Array(0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0);
  38. things[8] = new Array(0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0);
  39. things[9] = new Array(0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0);
  40. things[10] = new Array(0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0);
  41. things[11] = new Array(0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0);
  42. things[12] = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  43. targetscore = 90;
  44. for (row = 0; row < things.length; row++) {
  45.     for (col = 0; col < things[row].length; col++) {
  46.         if (things[row][col] > 0) {
  47.             duplicateMovieClip ("thing" add things[row][col], "thing" add row add "_" add col, level++);
  48.             this["thing" add row add "_" add col]._x = (col * tilewidth) + boardxoffset;
  49.             this["thing" add row add "_" add col]._y = (row * tileheight) + boardyoffset;
  50.         }
  51.     }
  52. }
  53. ghostStartCol = 13;        
  54. ghostStartRow = 1;        
  55. ghostSpeed = 4;            
  56. numGhosts = 4;            
  57. ghostColPositions = new Array();
  58. ghostRowPositions = new Array();
  59. for (num = 0; num < numGhosts; num++) {
  60.     duplicateMovieClip("ghost", "ghost" add num, level++);
  61.     ghostColPositions[num] = ghostStartCol;
  62.     ghostRowPositions[num] = ghostStartRow;
  63.     this["ghost"add num]._x = (ghostColPositions[num] * tilewidth) + boardxoffset;
  64.     this["ghost"add num]._y = (ghostRowPositions[num] * tileheight) + boardyoffset;
  65. }
  66. martynCol = 1;
  67. martynRow = 1;
  68. martynScore = 0;
  69. martynLives = 3;
  70. martynSpeed = 4;
  71. martynWalking = 0;
  72. duplicateMovieClip("martynRight", "martyn", level++);
  73. martyn._x = martynCol * tilewidth + boardxoffset;
  74. martyn._y = martynRow * tileheight + boardyoffset;
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

not relly sure, but it could be from the duplicateMovieClip.
Try to use it as: mc.duplicateMovieClip("new instance", depth);
Also instead of "add" instruction use "+".
i.e.:
duplicateMovieClip ("tile" add board[row][col], "tile" add row add "_" add col, level++);
will become:
var crtClip = this["tile" + board[row][col]];
crtClip.duplicateMovieClip("tile"+row+"_"+col, level++);

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 12 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.