|
var mouseSound:Sound = new Sound(); mouseSound.attachSound(”Ding”); this.onMouseDown = function() { mouseSound.start(); }; var startSound:Sound = new Sound(); startSound.attachSound(”tada1″); this.onLoad = function() { startSound.start(); }; // Drag a piece O. O_mc.onPress = function() { this.startDrag(false); }; // When the O is placed on a square. O_mc.onRelease = function() { this.stopDrag(); // Convert the slash notation to dot notation using eval. if (eval(this._droptarget) == Board6_mc) { O_mc._visible = false; } }; // Drag a piece O. O1_mc.onPress = function() { this.startDrag(false); }; // When the O is placed on a square. O1_mc.onRelease = function() { this.stopDrag(); // Convert the slash notation to dot notation using eval. if (eval(this._droptarget) == Board6_mc) { O1_mc._visible = false; } }; // Drag a piece O. O2_mc.onPress = function() { this.startDrag(false); }; // When the O is placed on a square. O2_mc.onRelease = function() { this.stopDrag(); // Convert the slash notation to dot notation using eval. if (eval(this._droptarget) == Board6_mc) { O2_mc._visible = false; } }; // Drag a piece O. O3_mc.onPress = function() { this.startDrag(false); }; // When the O is placed on a square. O3_mc.onRelease = function() { this.stopDrag(); // Convert the slash notation to dot notation using eval. if (eval(this._droptarget) == Board6_mc) { O3_mc._visible = false; } }; // Drag a piece O. O4_mc.onPress = function() { this.startDrag(false); }; // When the O is placed on a square. O4_mc.onRelease = function() { this.stopDrag(); // Convert the slash notation to dot notation using eval. if (eval(this._droptarget) == Board6_mc) { O4_mc._visible = false; } }; // Drag a piece O. O5_mc.onPress = function() { this.startDrag(false); }; // When the O is placed on a square. O5_mc.onRelease = function() { this.stopDrag(); // Convert the slash notation to dot notation using eval. if (eval(this._droptarget) == Board6_mc) { O5_mc._visible = false; } }; // Drag a piece X. X_mc.onPress = function() { this.startDrag(false); }; // When the X is placed on a square. X_mc.onRelease = function() { this.stopDrag(); // Convert the slash notation to dot notation using eval. if (eval(this._droptarget) == Board6_mc) { X_mc._visible = false; } }; // Drag a piece X. X1_mc.onPress = function() { this.startDrag(false); }; // When the X is placed on a square. X1_mc.onRelease = function() { this.stopDrag(); // Convert the slash notation to dot notation using eval. if (eval(this._droptarget) == Board6_mc) { X1_mc._visible = false; } }; // Drag a piece X. X2_mc.onPress = function() { this.startDrag(false); }; // When the X is placed on a square. X2_mc.onRelease = function() { this.stopDrag(); // Convert the slash notation to dot notation using eval. if (eval(this._droptarget) == Board6_mc) { X2_mc._visible = false; } }; // Drag a piece X. X3_mc.onPress = function() { this.startDrag(false); }; // When the X is placed on a square. X3_mc.onRelease = function() { this.stopDrag(); // Convert the slash notation to dot notation using eval. if (eval(this._droptarget) == Board6_mc) { X3_mc._visible = false; } }; // Drag a piece X. X4_mc.onPress = function() { this.startDrag(false); }; // When the X is placed on a square. X4_mc.onRelease = function() { this.stopDrag(); // Convert the slash notation to dot notation using eval. if (eval(this._droptarget) == Board6_mc) { X4_mc._visible = false; } }; // Drag a piece X. X5_mc.onPress = function() { this.startDrag(false); }; // When the X is placed on a square. X5_mc.onRelease = function() { this.stopDrag(); // Convert the slash notation to dot notation using eval. if (eval(this._droptarget) == Board6_mc) { X5_mc._visible = false; } }; var board_array = new Array(); // Create the array for(var i = 0; i < total_turns; i ) { array[i] = i; } var winning_array:Array = new Array(); // Contain winning combinations winning_array = [ // Vertical/Column Win [0,1,2], [3,4,5], [6,7,8], // Horizontal/Row Win [0,3,6], [1,4,7], [2,5,8], // Diagonal Win [0,4,8], [6,4,2] ] // Compare the winning array to the player’s for(var i = 0; i = 3) for(var k = 0; k < player_array.length; k ) for(var j = 0; j < winning_combination.length; j ) if(player_array[k] == winning_combination[j]) match_counter ; if(match_counter == 3) is_match = true; wc = winning_array[i]; break; match_counter = 0; function checkWin() { if(display1.text == ” X ” && display2.text == ” X” && display3.text == ” X”) { text_winner = ” Player X has Won”; } }
//in the release action of your button checkWin(); function checkWin() { if(display1.text == ” O ” && display2.text == ” X” && display3.text == ” X”) { text_winner = ” Player O has Won”; } }
|