Section 1
//Block (actionscript.Block)
package actionscript {
import flash.display.*;
import fl.transitions.*;
public class Block extends MovieClip {
public var _tween:Tween;
public function setTween(_arg1:Tween):uint{
_tween = _arg1;
_tween.addEventListener(TweenEvent.MOTION_FINISH, finishTween);
}
public function remove():void{
this.parent.removeChild(this);
}
private function finishTween(_arg1:TweenEvent):void{
_tween = null;
}
}
}//package actionscript
Section 2
//ClearColumnBlock (actionscript.ClearColumnBlock)
package actionscript {
public class ClearColumnBlock extends ItemBlock {
}
}//package actionscript
Section 3
//ClearRowBlock (actionscript.ClearRowBlock)
package actionscript {
public class ClearRowBlock extends ItemBlock {
}
}//package actionscript
Section 4
//Explosion (actionscript.Explosion)
package actionscript {
import flash.display.*;
import flash.geom.*;
public class Explosion {
private const EXPLOSION_MAX_VELOCITY:Number = 2;
private const EXPLOSION_MAX_HEAT:int = 2;
private const PARTICLE_DAMP_MOVE:Number = 0.99;
private const PARTICLE_DAMP_ENERGIE:Number = 0.99;
private const PARTICLE_CHAOTIC_MOVE:Number = 0.1825;
private const PCOUNT_EACH_FRAME:int = 100;
private var P_COUNT:int;
private var c_particles:Array;
private var EXPLOSION_RADIUS:int;
private var t_particles:Array;
private var transform:ColorTransform;
private var energie:Number;
public function Explosion(_arg1:Number, _arg2:Number, _arg3:int=3000, _arg4:Number=40){
init(_arg1, _arg2, _arg3, _arg4);
}
private function init(_arg1:Number, _arg2:Number, _arg3:int, _arg4:Number):void{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Particle;
var _local9:int;
P_COUNT = _arg3;
EXPLOSION_RADIUS = _arg4;
t_particles = new Array();
c_particles = new Array();
energie = 1;
_local9 = 0;
while (_local9 < P_COUNT) {
_local5 = ((Math.random() * Math.PI) * 2);
_local6 = (Math.random() * EXPLOSION_MAX_VELOCITY);
_local7 = (Math.random() * EXPLOSION_RADIUS);
_local8 = new Particle((_arg1 + (Math.sin(_local5) * _local7)), (_arg2 + (Math.cos(_local5) * _local7)), (Math.sin(_local5) * _local6), ((Math.cos(_local5) * _local6) - (Math.random() * EXPLOSION_MAX_HEAT)), 1, PARTICLE_DAMP_ENERGIE);
t_particles.push(_local8);
_local9++;
};
}
public function render(_arg1:BitmapData):void{
var _local2:Particle;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:int;
var _local8:int;
if (t_particles.length >= PCOUNT_EACH_FRAME){
c_particles = c_particles.concat(t_particles.splice(-(PCOUNT_EACH_FRAME)));
} else {
if (t_particles.length > 0){
c_particles = t_particles.splice();
};
};
_local8 = c_particles.length;
while (--_local8 > -1) {
_local2 = c_particles[_local8];
_local3 = _local2.sx;
_local4 = _local2.sy;
_local5 = _local2.vx;
_local6 = _local2.vy;
_local5 = (_local5 + ((Math.random() / (0.5 / PARTICLE_CHAOTIC_MOVE)) - PARTICLE_CHAOTIC_MOVE));
_local6 = (_local6 + ((Math.random() / (0.5 / PARTICLE_CHAOTIC_MOVE)) - PARTICLE_CHAOTIC_MOVE));
if (_local2.energie < 0.1){
c_particles.splice(_local8, 1);
};
_local2.energie = (_local2.energie * _local2.energieDamp);
_arg1.setPixel(_local3, _local4, int((_local2.energie * 0xFF)));
_local3 = (_local3 + _local5);
_local4 = (_local4 + _local6);
_local5 = (_local5 * PARTICLE_DAMP_MOVE);
_local6 = (_local6 * PARTICLE_DAMP_MOVE);
_local2.sx = _local3;
_local2.sy = _local4;
_local2.vx = _local5;
_local2.vy = _local6;
};
}
}
}//package actionscript
Section 5
//FlipBlock (actionscript.FlipBlock)
package actionscript {
public class FlipBlock extends ItemBlock {
}
}//package actionscript
Section 6
//Game (actionscript.Game)
package actionscript {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.ui.*;
public class Game extends MovieClip {
private var _player1:Player;
private var _player2:Player;
private var _player2PiecePreview:PiecePreview;
private var _paused:Boolean;// = false
private var _timer:Timer;
private var _pieceQueue:Array;
private var _muted:Boolean;// = false
public var preloader:MovieClip;
private var _mode:String;
public var menu_mc:MovieClip;
private var _game:String;
public var pattern_arrow1:MovieClip;
public var pattern_arrow2:MovieClip;
private var _numPlayers:uint;// = 1
public var pattern_negatives1:MovieClip;
public var pattern_negatives2:MovieClip;
private var _music:SoundChannel;
private var _patternGrid:Array;
private var _gameOver:GameOver;
private var _itemsEnabled:Boolean;// = true
private var _pieceBag:Array;
private var _gameOver2:GameOver;
private var _player1PiecePreview:PiecePreview;
private var _sharedObject:SharedObject;
public var pattern_floaters1:MovieClip;
public var pattern_floaters2:MovieClip;
public function Game(){
var _local1:ContextMenu;
var _local2:ContextMenuItem;
_numPlayers = 1;
_pieceBag = new Array();
_itemsEnabled = true;
_paused = false;
_muted = false;
super();
addFrameScript(0, frame1, 10, frame11);
_sharedObject = SharedObject.getLocal("tetris");
if (!_sharedObject.data.highScore){
_sharedObject.data.highScore = 0;
};
if (!_sharedObject.data.mostLines){
_sharedObject.data.mostLines = 0;
};
if (!_sharedObject.data.lastLevelStart){
_sharedObject.data.lastLevelStart = 0;
};
if (!_sharedObject.data.highScoreName){
_sharedObject.data.highScoreName = "";
};
_sharedObject.flush();
_local1 = new ContextMenu();
_local1.hideBuiltInItems();
_local2 = new ContextMenuItem("www.thewebpageofdan.com");
_local2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, clickMenuLink);
_local1.customItems.push(_local2);
contextMenu = _local1;
}
public function randRange(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
_local3 = Math.min(_arg1, _arg2);
_local4 = Math.max(_arg1, _arg2);
return ((Math.floor((Math.random() * ((_local4 - _local3) + 1))) + _local3));
}
public function getChallengeTime(_arg1:String):String{
if (!_sharedObject.data[_arg1]){
_sharedObject.data[_arg1] = 0;
_sharedObject.flush();
};
return (toTime(_sharedObject.data[_arg1]));
}
public function getMode():String{
return (_mode);
}
public function playSound(_arg1:String, _arg2:Number=1):SoundChannel{
var _local3:Class;
var _local4:*;
var _local5:SoundChannel;
var _local6:SoundTransform;
if (_muted){
return;
};
_local3 = (getDefinitionByName(_arg1) as Class);
_local4 = new (_local3);
_local5 = _local4.play();
_local6 = _local5.soundTransform;
_local6.volume = _arg2;
_local5.soundTransform = _local6;
return (_local5);
}
private function timerHandler(_arg1:TimerEvent):void{
menu_mc.timer.text = toTime(_arg1.target.currentCount);
}
public function isMuted():Boolean{
return (_muted);
}
public function getGame():String{
return (_game);
}
function frame1(){
stop();
}
private function musicComplete(_arg1:Event):void{
startMusic();
}
public function getMostLines():uint{
return (_sharedObject.data.mostLines);
}
function frame11(){
pattern_arrow1.visible = (pattern_floaters1.visible = (pattern_negatives1.visible = false));
pattern_arrow2.visible = (pattern_floaters2.visible = (pattern_negatives2.visible = false));
}
private function keyReleased(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == 80){
pauseGame();
return;
};
if (_paused){
return;
};
if (getNumPlayers() == 2){
switch (_arg1.keyCode){
case Keyboard.UP:
_player2.rotatePiece();
break;
case Keyboard.DOWN:
_player2.movePiece("down", true);
break;
case 87:
_player1.rotatePiece();
break;
case 83:
_player1.movePiece("down", true);
break;
case Keyboard.LEFT:
_player2.moveLeft();
break;
case Keyboard.RIGHT:
_player2.moveRight();
break;
case 65:
_player1.moveLeft();
break;
case 68:
_player1.moveRight();
break;
};
} else {
switch (_arg1.keyCode){
case Keyboard.UP:
case 87:
_player1.rotatePiece();
break;
case Keyboard.DOWN:
case 83:
_player1.movePiece("down", true);
break;
case Keyboard.LEFT:
case 65:
_player1.moveLeft();
break;
case Keyboard.RIGHT:
case 68:
_player1.moveRight();
break;
case Keyboard.SPACE:
_player1.holdPiece();
break;
};
};
}
public function toggleItems():void{
_itemsEnabled = (_itemsEnabled) ? false : true;
}
private function startMusic():void{
var _local1:*;
var _local2:SoundTransform;
_local1 = new Music();
_music = _local1.play();
_local2 = _music.soundTransform;
_local2.volume = (_muted) ? 0 : 0.2;
_music.soundTransform = _local2;
_music.addEventListener(Event.SOUND_COMPLETE, musicComplete);
}
public function submitHighScore(_arg1:String):void{
var variables:URLVariables;
var request:URLRequest;
var entryName = _arg1;
_sharedObject.data.highScoreName = entryName;
_sharedObject.flush();
variables = new URLVariables();
variables.game_id = 2;
variables.name = entryName;
variables.score = _player1.getScore();
variables.code = "ifwpmkqxle";
request = new URLRequest("http://thewebpageofdan.com/highscore.php");
request.data = variables;
try {
sendToURL(request);
} catch(err:Error) {
};
}
public function isPaused():Boolean{
return (_paused);
}
public function pauseGame():void{
if (_paused){
_timer.start();
menu_mc.pause_btn.visible = true;
menu_mc.unpause_btn.visible = false;
_paused = false;
startMusic();
} else {
_music.stop();
_timer.stop();
menu_mc.pause_btn.visible = false;
menu_mc.unpause_btn.visible = true;
_paused = true;
};
}
public function setMostLines(_arg1:uint):uint{
_sharedObject.data.mostLines = _arg1;
_sharedObject.flush();
}
public function getHighScoreName():String{
return (_sharedObject.data.highScoreName);
}
public function clearScreen():void{
_player1.visible = false;
if (_numPlayers == 2){
_player2.visible = false;
};
if (((_gameOver) && (this.contains(_gameOver)))){
removeChild(_gameOver);
};
if (((_gameOver2) && (this.contains(_gameOver2)))){
removeChild(_gameOver2);
};
}
public function addPiecesToQueue(_arg1:uint=1):void{
var _local2:uint;
var _local3:uint;
var _local4:Class;
var _local5:Piece;
if (!_pieceBag.length){
_pieceBag = new Array(1, 2, 3, 4, 5, 6, 7);
};
_local2 = 1;
while (_local2 <= _arg1) {
if (!_pieceQueue.length){
do {
_local3 = randRange(0, (_pieceBag.length - 1));
} while ((((((_local3 == 1)) || ((_local3 == 5)))) || ((_local3 == 6))));
} else {
_local3 = randRange(0, (_pieceBag.length - 1));
};
_local3 = _pieceBag.splice(_local3, 1);
_local4 = (getDefinitionByName(("Piece" + _local3)) as Class);
_local5 = new (_local4);
_local5.setPieceNum(_local3);
_pieceQueue.push(_local5);
_player1PiecePreview.addPiece(_local3);
if (_numPlayers == 2){
_player2PiecePreview.addPiece(_local3);
};
_local2++;
};
}
public function getPiece(_arg1:uint):Piece{
if (_arg1 <= (_pieceQueue.length - 4)){
addPiecesToQueue(1);
};
return (_pieceQueue[_arg1]);
}
public function getNumPlayers():uint{
return (_numPlayers);
}
public function getHighScore():uint{
return (_sharedObject.data.highScore);
}
public function getLastLevelStart():uint{
return (_sharedObject.data.lastLevelStart);
}
public function endGame(_arg1:uint=0):void{
var _local2:uint;
var _local3:uint;
var _local4:Number;
var _local5:uint;
stage.removeEventListener(KeyboardEvent.KEY_UP, keyReleased);
_timer.stop();
_music.stop();
pattern_arrow1.visible = (pattern_floaters1.visible = (pattern_negatives1.visible = false));
pattern_arrow2.visible = (pattern_floaters2.visible = (pattern_negatives2.visible = false));
_local2 = Math.floor((_timer.currentCount / 100));
_local3 = Math.floor((_local2 / 60));
if (_numPlayers == 2){
_gameOver = new GameOver();
addChild(_gameOver);
_gameOver.x = 4;
_gameOver.y = 0;
_gameOver2 = new GameOver();
addChild(_gameOver2);
_gameOver2.x = 306;
_gameOver2.y = 0;
if (_arg1 == 2){
_gameOver2.title.text = ((getMode())!="reguar") ? "COMPLETE" : "WINNER";
_gameOver.title.text = "GAME OVER";
} else {
if (_arg1 == 1){
_gameOver.title.text = ((getMode())!="reguar") ? "COMPLETE" : "WINNER";
_gameOver2.title.text = "GAME OVER";
} else {
if (_mode == "regular"){
_gameOver.title.text = (_gameOver2.title.text = "GAME OVER");
} else {
_gameOver.title.text = (_gameOver2.title.text = "DRAW");
};
};
};
_player1.cleanUp();
_player2.cleanUp();
_gameOver.high_score.visible = false;
_gameOver2.high_score.visible = false;
_local4 = (_local3) ? (_player2.getQueuePosition() / _local3) : _player2.getQueuePosition();
_local5 = _player2.getLines();
_gameOver2.time.text = ("Played for " + toTime(_timer.currentCount));
_gameOver2.tetrominoes.text = (("Played " + _player2.getQueuePosition()) + " tetrominoes");
_gameOver2.per_minute.text = (("- " + _local4.toFixed(2)) + " per minute");
_gameOver2.lines.text = ((("Made " + _local5) + " line") + ((_local5)==1) ? "" : "s");
_gameOver2.singles.text = ("- Singles: " + _player2.getSingles());
_gameOver2.doubles.text = ("- Doubles: " + _player2.getDoubles());
_gameOver2.triples.text = ("- Triples: " + _player2.getTriples());
_gameOver2.tetrises.text = ("- Tetrises: " + _player2.getTetrises());
_gameOver2.score.text = ("Score: " + _player2.getScore());
} else {
_player1.cleanUp();
_gameOver = new GameOver();
addChild(_gameOver);
_gameOver.x = 4;
_gameOver.y = 0;
if (getMode() != "regular"){
_gameOver.high_score.visible = false;
if (_arg1){
_gameOver.title.text = "COMPLETE";
};
} else {
_gameOver.title.text = "GAME OVER";
};
};
_local4 = (_local3) ? (_player1.getQueuePosition() / _local3) : _player1.getQueuePosition();
_local5 = _player1.getLines();
_gameOver.time.text = ("Played for " + toTime(_timer.currentCount));
_gameOver.tetrominoes.text = (("Played " + _player1.getQueuePosition()) + " tetrominoes");
_gameOver.per_minute.text = (("- " + _local4.toFixed(2)) + " per minute");
_gameOver.lines.text = ((("Made " + _local5) + " line") + ((_local5)==1) ? "" : "s");
_gameOver.singles.text = ("- Singles: " + _player1.getSingles());
_gameOver.doubles.text = ("- Doubles: " + _player1.getDoubles());
_gameOver.triples.text = ("- Triples: " + _player1.getTriples());
_gameOver.tetrises.text = ("- Tetrises: " + _player1.getTetrises());
_gameOver.score.text = ("Score: " + _player1.getScore());
if (((_arg1) && ((_mode == "challenge")))){
if (((!(_sharedObject.data[_game])) || ((_timer.currentCount < _sharedObject.data[_game])))){
_sharedObject.data[_game] = _timer.currentCount;
_sharedObject.flush();
};
};
}
private function clickMenuLink(_arg1:ContextMenuEvent):void{
navigateToURL(new URLRequest("http://thewebpageofdan.com"), "_blank");
}
public function toggleMute():void{
var _local1:SoundTransform;
_local1 = _music.soundTransform;
if (_muted){
_muted = false;
_local1.volume = 0.2;
} else {
_muted = true;
_local1.volume = 0;
};
_music.soundTransform = _local1;
}
public function newGame(_arg1:uint=1, _arg2:uint=1, _arg3:String="regular", _arg4:String=""):void{
if (((_gameOver) && (this.contains(_gameOver)))){
removeChild(_gameOver);
};
if (((_gameOver2) && (this.contains(_gameOver2)))){
removeChild(_gameOver2);
};
_mode = _arg3;
_game = _arg4;
_numPlayers = _arg2;
if (_mode == "pattern"){
this[(("pattern_" + _arg4) + "1")].visible = true;
if (_numPlayers == 2){
this[(("pattern_" + _arg4) + "2")].visible = true;
};
};
_pieceQueue = new Array();
_pieceBag = new Array();
if (_numPlayers == 2){
_player1PiecePreview = menu_mc.small_preview1_mc;
_player2PiecePreview = menu_mc.small_preview2_mc;
_player1PiecePreview.setPieceScale(0.5);
_player2PiecePreview.setPieceScale(0.5);
_player1PiecePreview.clear();
_player2PiecePreview.clear();
} else {
_player1PiecePreview = menu_mc.preview1_mc;
_player1PiecePreview.clear();
};
addPiecesToQueue(5);
if (_player1){
removeChild(_player1);
};
if (_player2){
removeChild(_player2);
};
_player1 = new PlayArea();
_player1.setPlayerNum(1);
addChild(_player1);
_player1.x = 14;
_player1.y = 50;
_player1.changeLevel(_arg1);
_player1.startPieces();
if (_numPlayers == 2){
_player2 = new PlayArea();
_player2.setPlayerNum(2);
addChild(_player2);
_player2.x = 316;
_player2.y = 50;
_player2.changeLevel(_arg1);
_player2.startPieces();
};
stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
stage.focus = stage;
_timer = new Timer(10);
_timer.addEventListener(TimerEvent.TIMER, timerHandler);
_timer.start();
startMusic();
_sharedObject.data.lastLevelStart = _arg1;
_sharedObject.flush();
}
public function isItemsEnabled():Boolean{
return (_itemsEnabled);
}
public function setHighScore(_arg1:uint):uint{
_sharedObject.data.highScore = _arg1;
_sharedObject.flush();
}
private function toTime(_arg1:uint):String{
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local8:String;
var _local9:String;
var _local10:String;
var _local11:String;
_local2 = Math.floor((_arg1 / 100));
_local3 = Math.floor((_local2 / 60));
_local4 = Math.floor((_local3 / 60));
_local5 = (_local3 - (_local4 * 60));
_local6 = (_local2 - (_local3 * 60));
_local7 = (_arg1 - (_local2 * 100));
_local8 = ((_local7)>=10) ? _local7 : ("0" + _local7);
_local9 = ((_local6)>=10) ? _local6 : ("0" + _local6);
_local10 = ((_local5)>=10) ? _local5 : ("0" + _local5);
_local11 = ((_local4)>=10) ? _local4 : ("0" + _local4);
return (String(((((((_local11 + ":") + _local10) + ":") + _local9) + ".") + _local8)));
}
}
}//package actionscript
Section 7
//Gradient (actionscript.Gradient)
package actionscript {
import flash.display.*;
import flash.geom.*;
public class Gradient {
private static const IDENTITY:Matrix = new Matrix();
public static function getArray(_arg1:Array, _arg2:Array, _arg3:Array):Array{
var _local4:Array;
var _local5:Shape;
var _local6:Matrix;
var _local7:BitmapData;
var _local8:Graphics;
var _local9:uint;
var _local10:int;
_local4 = new Array();
_local5 = new Shape();
_local6 = new Matrix();
_local7 = new BitmapData(0x0100, 1, true, 0);
_local8 = _local5.graphics;
_local6.createGradientBox(0x0100, 0x0100, 0, 0, 0);
_local8.clear();
_local8.beginGradientFill("linear", _arg1, _arg2, _arg3, _local6);
_local8.drawRect(0, 0, 0x0100, 0x0100);
_local8.endFill();
_local7.draw(_local5, IDENTITY);
_local10 = 0;
while (_local10 < 0x0100) {
_local9 = _local7.getPixel32(_local10, 0);
_local4.push(_local9);
_local10++;
};
return (_local4);
}
}
}//package actionscript
Section 8
//GravityBlock (actionscript.GravityBlock)
package actionscript {
public class GravityBlock extends ItemBlock {
}
}//package actionscript
Section 9
//ItemBlock (actionscript.ItemBlock)
package actionscript {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class ItemBlock extends Block {
private var _scope:MovieClip;
private var _timer:Timer;
private var _prevBlock:Block;
public function ItemBlock(){
addEventListener(Event.ADDED, setScope);
}
private function setScope(_arg1:Event):void{
removeEventListener(Event.ADDED, setScope);
_scope = root;
_timer = new Timer(1000, _scope.randRange(10, 15));
_timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerComplete);
_timer.start();
}
public function stopTimer():void{
_timer.stop();
}
override public function remove():void{
stopTimer();
super.remove();
}
private function timerComplete(_arg1:TimerEvent):void{
if (this.parent){
dispatchEvent(new Event("fizzle"));
};
}
}
}//package actionscript
Section 10
//Message (actionscript.Message)
package actionscript {
import flash.display.*;
import flash.events.*;
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.text.*;
public class Message extends MovieClip {
private var _player:uint;
private var _xScaleTween:Tween;
public var player_msg:TextField;
private var _alphaTween:Tween;
private var _scope:MovieClip;
private var _msg:String;
private var _yScaleTween:Tween;
public function Message(_arg1:String="", _arg2:uint=1){
if (!_arg1){
return;
};
_msg = _arg1;
_player = _arg2;
player_msg.text = _msg;
addEventListener(Event.ADDED, setScope);
}
private function setScope(_arg1:Event):void{
_scope = root;
this.y = 200;
this.x = ((_player)==1) ? 110 : 412;
_yScaleTween = new Tween(this, "scaleY", Strong.easeOut, 0.5, 1, 2, true);
_yScaleTween.start();
_xScaleTween = new Tween(this, "scaleX", Strong.easeOut, 0.5, 1, 2, true);
_xScaleTween.start();
_alphaTween = new Tween(this, "alpha", Strong.easeOut, 0, 1, 1, true);
_alphaTween.start();
_yScaleTween.addEventListener(TweenEvent.MOTION_FINISH, fadeOut);
}
private function fadeOut(_arg1:TweenEvent):void{
_yScaleTween.removeEventListener(TweenEvent.MOTION_FINISH, fadeOut);
_yScaleTween = new Tween(this, "scaleY", Strong.easeOut, 1, 1.5, 0.8, true);
_yScaleTween.start();
_xScaleTween = new Tween(this, "scaleX", Strong.easeOut, 1, 1.5, 0.8, true);
_xScaleTween.start();
_alphaTween = new Tween(this, "alpha", Strong.easeOut, 1, 0, 1, true);
_alphaTween.addEventListener(TweenEvent.MOTION_FINISH, removeMsg);
_alphaTween.addEventListener(TweenEvent.MOTION_STOP, removeMsg);
_alphaTween.start();
}
private function removeMsg(_arg1:TweenEvent):void{
remove();
}
public function remove():void{
_yScaleTween.removeEventListener(TweenEvent.MOTION_FINISH, fadeOut);
_alphaTween.removeEventListener(TweenEvent.MOTION_FINISH, removeMsg);
_alphaTween.removeEventListener(TweenEvent.MOTION_STOP, removeMsg);
this.parent.removeChild(this);
}
}
}//package actionscript
Section 11
//NukeBlock (actionscript.NukeBlock)
package actionscript {
public class NukeBlock extends ItemBlock {
}
}//package actionscript
Section 12
//Particle (actionscript.Particle)
package actionscript {
public class Particle {
public var vx:Number;
public var vy:Number;
public var sx:Number;
public var sy:Number;
public var energie:Number;
public var energieDamp:Number;
public function Particle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number){
this.sx = _arg1;
this.sy = _arg2;
this.vx = _arg3;
this.vy = _arg4;
this.energie = _arg5;
this.energieDamp = _arg6;
}
}
}//package actionscript
Section 13
//Piece (actionscript.Piece)
package actionscript {
import flash.display.*;
import flash.events.*;
import fl.transitions.*;
public class Piece extends MovieClip {
public var gblock82:GhostBlock8;
public var gblock83:GhostBlock8;
public var gblock85:GhostBlock8;
public var block61:Block6;
public var gblock84:GhostBlock8;
public var block63:Block6;
public var block64:Block6;
public var block62:Block6;
public var gblock91:GhostBlock8;
public var gblock93:GhostBlock8;
public var gblock94:GhostBlock8;
public var gblock95:GhostBlock8;
public var gblock92:GhostBlock8;
public var block71:Block7;
public var block72:Block7;
public var block73:Block7;
public var block74:Block7;
public var block101:Block8;
public var block81:Block8;
public var block83:Block8;
public var block84:Block8;
public var block85:Block8;
public var block104:Block8;
public var block82:Block8;
public var block105:Block8;
public var block91:Block8;
public var block92:Block8;
public var block93:Block8;
public var block94:Block8;
public var block95:Block8;
public var block102:Block8;
public var block103:Block8;
private var _num:uint;
public var gblock11:GhostBlock1;
public var gblock14:GhostBlock1;
public var gblock12:GhostBlock1;
public var gblock13:GhostBlock1;
public var gblock21:GhostBlock2;
public var gblock23:GhostBlock2;
public var gblock24:GhostBlock2;
public var gblock22:GhostBlock2;
public var gblock31:GhostBlock3;
public var gblock32:GhostBlock3;
public var gblock33:GhostBlock3;
public var block12:Block1;
public var block13:Block1;
public var block14:Block1;
public var _tween:Tween;
public var gblock34:GhostBlock3;
public var block11:Block1;
public var gblock41:GhostBlock4;
public var gblock42:GhostBlock4;
public var gblock43:GhostBlock4;
public var block23:Block2;
public var gblock44:GhostBlock4;
public var block21:Block2;
public var block22:Block2;
public var block24:Block2;
public var gblock51:GhostBlock5;
public var gblock53:GhostBlock5;
public var gblock52:GhostBlock5;
public var gblock54:GhostBlock5;
public var block33:Block3;
public var gblock104:GhostBlock8;
public var gblock105:GhostBlock8;
public var block31:Block3;
public var block32:Block3;
public var gblock102:GhostBlock8;
public var block34:Block3;
public var gblock101:GhostBlock8;
public var gblock103:GhostBlock8;
public var gblock61:GhostBlock6;
public var gblock62:GhostBlock6;
public var gblock63:GhostBlock6;
public var block41:Block4;
public var block43:Block4;
public var block42:Block4;
public var gblock64:GhostBlock6;
public var gblock71:GhostBlock7;
public var gblock72:GhostBlock7;
public var gblock73:GhostBlock7;
public var gblock74:GhostBlock7;
public var block44:Block4;
public var block51:Block5;
public var block53:Block5;
public var block52:Block5;
public var block54:Block5;
public var gblock81:GhostBlock8;
public function setPieceNum(_arg1:uint):void{
_num = _arg1;
}
private function remove(_arg1:Event):void{
this.parent.removeChild(this);
}
public function getPieceNum():uint{
return (_num);
}
public function setTween(_arg1:Tween):uint{
_tween = _arg1;
_tween.addEventListener(TweenEvent.MOTION_FINISH, finishTween);
}
private function finishTween(_arg1:TweenEvent):void{
_tween = null;
}
}
}//package actionscript
Section 14
//PiecePreview (actionscript.PiecePreview)
package actionscript {
import flash.display.*;
import fl.transitions.*;
import fl.transitions.easing.*;
import fl.motion.*;
import flash.utils.*;
import flash.filters.*;
public class PiecePreview extends MovieClip {
private var _pieces:Array;
private var _addHeight:Number;// = 0
private var _pieceScale:Number;// = 0.9
public function PiecePreview(){
_pieceScale = 0.9;
_addHeight = 0;
_pieces = new Array();
super();
}
public function setPieceScale(_arg1:Number):void{
_pieceScale = _arg1;
}
public function clear():void{
var _local1:uint;
for (_local1 in _pieces) {
removeChild(_pieces[_local1]);
};
_pieces = new Array();
_addHeight = 0;
}
public function removePiece():void{
var _local1:Piece;
var _local2:Number;
var _local3:uint;
var _local4:GlowFilter;
if (!_pieces.length){
return;
};
_local1 = _pieces.shift();
_local2 = (_local1.y + _local1.height);
_addHeight = (_addHeight - _local2);
removeChild(_local1);
for (_local3 in _pieces) {
if (!_local3){
_local4 = new GlowFilter(0xFFFFFF, 1, 6, 6, 5, 1, false, false);
_pieces[_local3].filters = new Array(_local4);
};
if (!_pieces[_local3]._tween){
_pieces[_local3]._tween = new Tween(_pieces[_local3], Tweenables.Y, Strong.easeOut, _pieces[_local3].y, (_pieces[_local3].y - _local2), 0.5, true);
} else {
_pieces[_local3]._tween.continueTo((_pieces[_local3]._tween.finish - _local2), 0.5);
};
};
}
public function addPiece(_arg1:uint):void{
var _local2:Class;
var _local3:Piece;
_local2 = (getDefinitionByName((("Piece" + _arg1) + "NoPivot")) as Class);
_local3 = new (_local2);
addChild(_local3);
_pieces.push(_local3);
_local3.scaleX = _pieceScale;
_local3.scaleY = _pieceScale;
_local3.x = 0;
_local3.y = (_addHeight + 15);
_addHeight = (_local3.y + _local3.height);
}
}
}//package actionscript
Section 15
//Player (actionscript.Player)
package actionscript {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.geom.*;
import fl.motion.*;
import flash.utils.*;
import flash.filters.*;
public class Player extends MovieClip {
private var _lines:uint;// = 0
private var _gridBlocks:Array;
private var _blockLength:Number;// = 20
private var _grid:Array;
private var _powerUpBlocks:Array;
private var _explosionOutput:BitmapData;
public var tetris_flash:MovieClip;
private var _linesRemoved:Array;
private var _nuke:Boolean;// = false
private var _explosionOrigin:Point;
private var _explosionBitmap:Bitmap;
private var _frameRate:uint;
private var _tweenX:Tween;
private var _triples:uint;// = 0
private var _rotateFrameRate:uint;// = 1
private var _gridWidth:uint;// = 10
private var _rotate:Boolean;// = false
private var _tweens:Array;
private var _holdAvailable:Boolean;// = true
private var _moveLeft:Boolean;// = false
private var _piecePreview:PiecePreview;
private var _tweenScaleX:Tween;
private var _gravity:Boolean;// = false
private var _numColumns:uint;// = 0
private var _explosionBlur:BlurFilter;
private var _ghostPiece:Piece;
private var _numRows:uint;// = 0
private var _moveRight:Boolean;// = false
private var _flip:Boolean;// = false
private var _scope:MovieClip;
private var _queuePosition:uint;// = 0
private var _playerNum:uint;
private var _rotateFrameCounter:uint;// = 0
private var _currentLevel:uint;// = 0
private var _playerMsg:Message;
private var _linesSinceChange:uint;// = 0
private var _explosionBuffer:BitmapData;
private var _explosionFireColors:Array;
private var _doubles:uint;// = 0
private var _score:uint;// = 0
private var _renderSprite2:Sprite;
private var _renderSprite3:Sprite;
private var _explosions:Array;
private var _gridHeight:uint;// = 20
private var _controlsDisabled:Boolean;// = false
private var _frameCounter:uint;
private var _activePiece:Piece;
private var _flashBlocks:Array;
private var _renderSprite:Sprite;
private var _tetrises:uint;// = 0
private var _singles:uint;// = 0
private var _nextPieceIsWeird:Boolean;// = false
private var _holdPiece:Piece;
public function Player(){
_grid = new Array();
_gridWidth = 10;
_gridHeight = 20;
_gridBlocks = new Array();
_powerUpBlocks = new Array();
_blockLength = 20;
_queuePosition = 0;
_holdAvailable = true;
_rotateFrameRate = 1;
_rotateFrameCounter = 0;
_rotate = false;
_moveLeft = false;
_moveRight = false;
_controlsDisabled = false;
_nextPieceIsWeird = false;
_currentLevel = 0;
_lines = 0;
_linesSinceChange = 0;
_singles = 0;
_doubles = 0;
_triples = 0;
_tetrises = 0;
_score = 0;
_flashBlocks = new Array();
_nuke = false;
_gravity = false;
_flip = false;
_numColumns = 0;
_numRows = 0;
_renderSprite = new Sprite();
_renderSprite2 = new Sprite();
_renderSprite3 = new Sprite();
_explosionOrigin = new Point();
super();
_grid = freshGrid();
_explosionOrigin = new Point();
_explosionBuffer = new BitmapData((this.width + _blockLength), (this.height + _blockLength), true);
_explosionOutput = new BitmapData((this.width + _blockLength), (this.height + _blockLength), true);
_explosionBitmap = new Bitmap(_explosionOutput);
_explosionBitmap.x = (_explosionBitmap.x - (_blockLength / 2));
_explosionBitmap.y = (_explosionBitmap.y - (_blockLength / 2));
_explosionBlur = new BlurFilter(2, 2, 1);
_explosionFireColors = Gradient.getArray([0, 0, 0x333333, 0xFF0000, 0xFFFF00, 0], [0, 0, 1, 1, 1, 0], [0, 34, 68, 85, 136, 0xFF]);
_renderSprite.addEventListener(Event.ENTER_FRAME, renderExplosions);
_renderSprite2.addEventListener(Event.ENTER_FRAME, renderExplosions);
_renderSprite3.addEventListener(Event.ENTER_FRAME, renderExplosions);
addEventListener(Event.ADDED, setScope);
}
private function nextPowerUp():void{
if (_gravity){
_gravity = false;
pullBlocksDown();
return;
};
if (_flip){
_flip = false;
flipPlayfield();
return;
};
if (_numColumns){
clearColumns(_numColumns);
};
if (_numRows){
i = 1;
while (i <= _numRows) {
clearRow((_gridHeight + 1));
i++;
};
};
continuePieces();
}
private function streamFade(_arg1:Event):void{
_arg1.target.alpha = (_arg1.target.alpha - 0.1);
if (_arg1.target.alpha <= 0){
_arg1.target.removeEventListener(Event.ENTER_FRAME, streamFade);
_arg1.target.parent.removeChild(_arg1.target);
};
}
private function renderExplosions(_arg1:Event):void{
var _local2:uint;
for (_local2 in _explosions) {
_explosions[_local2].render(_explosionBuffer);
};
_explosionBuffer.applyFilter(_explosionBuffer, _explosionBuffer.rect, _explosionOrigin, _explosionBlur);
_explosionOutput.copyPixels(_explosionBuffer, _explosionBuffer.rect, _explosionOrigin);
_explosionOutput.paletteMap(_explosionOutput, _explosionOutput.rect, _explosionOrigin, [], [], _explosionFireColors, []);
}
public function startPieces():void{
var _local1:MovieClip;
if (_scope.getMode() == "pattern"){
_local1 = _scope[(("pattern_" + _scope.getGame()) + _playerNum)];
_scope.setChildIndex(_local1, this.parent.getChildIndex(this));
};
nextPiece();
}
private function flipPlayfield():void{
if (_ghostPiece){
removeChild(_ghostPiece);
_ghostPiece = null;
};
for (i in _gridBlocks) {
_gridBlocks[i].scaleX = -1;
};
_tweenScaleX = new Tween(this, Tweenables.SCALE_X, Strong.easeOut, 1, -1, 0.5, true);
_tweenX = new Tween(this, Tweenables.X, Strong.easeOut, this.x, ((this.x + this.width) - _blockLength), 0.5, true);
_tweenX.addEventListener(TweenEvent.MOTION_FINISH, flipFinish);
}
public function rotatePiece():void{
if (_controlsDisabled){
return;
};
_rotate = true;
}
private function clearRow(_arg1:uint):void{
var _local2:Object;
var _local3:Array;
var _local4:Array;
var _local5:Array;
var _local6:Boolean;
_local3 = new Array();
_local4 = new Array();
_local5 = new Array();
for (j in _gridBlocks) {
_local2 = getBlockGridCoords(_gridBlocks[j]);
if (_local2.y == _arg1){
_gridBlocks[j].remove();
_local3.push(j);
};
};
for (j in _gridBlocks) {
_local6 = true;
for (k in _local3) {
if (_local3[k] == j){
_local6 = false;
break;
};
};
if (_local6){
_local4.push(_gridBlocks[j]);
};
};
_gridBlocks = _local4;
for (j in _gridBlocks) {
_local2 = getBlockGridCoords(_gridBlocks[j]);
if (_local2.y > _arg1){
} else {
if (!_gridBlocks[j]._tween){
_gridBlocks[j].setTween(new Tween(_gridBlocks[j], Tweenables.Y, Strong.easeOut, _gridBlocks[j].y, (_gridBlocks[j].y + _blockLength), 0.5, true));
} else {
_gridBlocks[j]._tween.continueTo((_gridBlocks[j]._tween.finish + _blockLength), 0.5);
};
};
};
j = (_gridHeight + 1);
while (j >= 1) {
if (j <= _arg1){
_local5.unshift(_grid[(j - 1)]);
} else {
_local5.unshift(_grid[j]);
};
j--;
};
_local5.unshift(new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
_grid = _local5;
}
private function lockPiece():void{
var _local1:uint;
var _local2:uint;
var _local3:uint;
var _local4:Object;
var _local5:Timer;
var _local6:Sprite;
var _local7:Point;
var _local8:Boolean;
_controlsDisabled = true;
_activePiece.removeEventListener(Event.ENTER_FRAME, everyFrame);
_local1 = 1;
while (_local1 <= 5) {
if (!_activePiece[(("block" + _activePiece.getPieceNum()) + _local1)]){
} else {
_local6 = _activePiece[(("block" + _activePiece.getPieceNum()) + _local1)];
_local4 = getBlockGridCoords(_local6);
if (_local4.y <= 1){
_scope.endGame();
return;
};
_grid[_local4.y][_local4.x] = 1;
_local7 = new Point(_local6.x, _local6.y);
_local7 = _local6.parent.localToGlobal(_local7);
_local7 = _local6.parent.parent.globalToLocal(_local7);
addChild(_local6);
_local6.x = _local7.x;
_local6.y = _local7.y;
_local6.rotation = (_local6.rotation - _local6.rotation);
_gridBlocks.push(_local6);
};
_local1++;
};
removeChild(_activePiece);
_scope.playSound("Lock", 0.3);
_linesRemoved = new Array();
for (_local1 in _grid) {
_local8 = true;
for (_local2 in _grid[_local1]) {
if (!_grid[_local1][_local2]){
_local8 = false;
break;
};
};
if (_local8){
_linesRemoved.push(_local1);
};
};
_flashBlocks = new Array();
_nuke = false;
_gravity = false;
_flip = false;
_numColumns = 0;
_numRows = 0;
for (_local1 in _linesRemoved) {
if (_scope.isItemsEnabled()){
for (_local2 in _gridBlocks) {
_local4 = getBlockGridCoords(_gridBlocks[_local2]);
if (_local4.y == _linesRemoved[_local1]){
if ((_gridBlocks[_local2] is ItemBlock)){
if ((_gridBlocks[_local2] is (getDefinitionByName("actionscript.NukeBlock") as Class))){
_nuke = true;
} else {
if ((_gridBlocks[_local2] is (getDefinitionByName("actionscript.GravityBlock") as Class))){
_gravity = true;
} else {
if ((_gridBlocks[_local2] is (getDefinitionByName("actionscript.ClearColumnBlock") as Class))){
_numColumns++;
} else {
if ((_gridBlocks[_local2] is (getDefinitionByName("actionscript.ClearRowBlock") as Class))){
_numRows++;
} else {
if ((_gridBlocks[_local2] is (getDefinitionByName("actionscript.WeirdPieceBlock") as Class))){
_nextPieceIsWeird = true;
} else {
if ((_gridBlocks[_local2] is (getDefinitionByName("actionscript.FlipBlock") as Class))){
_flip = true;
};
};
};
};
};
};
_flashBlocks.push(_gridBlocks[_local2]);
for (_local3 in _powerUpBlocks) {
if (_powerUpBlocks[_local3] == _gridBlocks[_local2]){
_powerUpBlocks.splice(_local3, 1);
break;
};
};
};
};
};
};
};
for (_local1 in _flashBlocks) {
if ((_flashBlocks[_local1] is (getDefinitionByName("actionscript.NukeBlock") as Class))){
_flashBlocks[_local1].play();
} else {
if (((!(_nuke)) && ((_flashBlocks[_local1] is (getDefinitionByName("actionscript.GravityBlock") as Class))))){
_flashBlocks[_local1].play();
} else {
if (((!(_nuke)) && ((_flashBlocks[_local1] is (getDefinitionByName("actionscript.ClearColumnBlock") as Class))))){
_flashBlocks[_local1].play();
} else {
if (((!(_nuke)) && ((_flashBlocks[_local1] is (getDefinitionByName("actionscript.ClearRowBlock") as Class))))){
_flashBlocks[_local1].play();
} else {
if ((_flashBlocks[_local1] is (getDefinitionByName("actionscript.WeirdPieceBlock") as Class))){
_flashBlocks[_local1].play();
} else {
if (((!(_nuke)) && ((_flashBlocks[_local1] is (getDefinitionByName("actionscript.FlipBlock") as Class))))){
_flashBlocks[_local1].play();
};
};
};
};
};
};
_flashBlocks[_local1].stopTimer();
};
_local5 = new Timer((_flashBlocks.length) ? 1000 : 1, 1);
_local5.addEventListener(TimerEvent.TIMER_COMPLETE, flashComplete);
_local5.start();
}
public function getDoubles():uint{
return (_doubles);
}
public function setPlayerNum(_arg1:uint):void{
_playerNum = _arg1;
}
private function holdListener(_arg1:Event):void{
var _local2:GlowFilter;
if (_holdAvailable){
_local2 = new GlowFilter(0xFFFFFF, 1, 6, 6, 5, 1, false, false);
_arg1.target.filters = new Array(_local2);
} else {
_arg1.target.filters = new Array();
};
}
public function cleanUp():uint{
var _local1:uint;
stopPieces();
removeHoldPiece();
for (_local1 in _powerUpBlocks) {
_powerUpBlocks[_local1].removeEventListener("fizzle", fizzlePowerUp);
};
}
private function clearColumns(_arg1:uint=1):void{
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:Beam;
var _local6:Array;
var _local7:Array;
var _local8:Boolean;
_local3 = 1;
while (_local3 <= _arg1) {
_local4 = _scope.randRange(0, (_gridWidth - 1));
_local5 = new Beam();
addChild(_local5);
_local5.x = (_local4 * _blockLength);
_local5.y = -10;
_local5.height = (_blockLength * _gridHeight);
_local6 = new Array();
for (_local2 in _gridBlocks) {
pieceCoords = getBlockGridCoords(_gridBlocks[_local2]);
if (pieceCoords.x == _local4){
_explosions.push(new Explosion(_gridBlocks[_local2].x, _gridBlocks[_local2].y, 3000, 2));
_gridBlocks[_local2].remove();
_local6.push(_local2);
};
};
_local7 = new Array();
for (_local2 in _gridBlocks) {
_local8 = true;
for (k in _local6) {
if (_local6[k] == _local2){
_local8 = false;
break;
};
};
if (_local8){
_local7.push(_gridBlocks[_local2]);
};
};
_gridBlocks = _local7;
for (_local2 in _grid) {
_grid[_local2][_local4] = 0;
};
_scope.playSound("BeamSound");
_local3++;
};
}
private function continuePieces():void{
_queuePosition++;
nextPiece();
_holdAvailable = true;
}
public function moveRight():void{
_moveRight = true;
}
public function getSingles():uint{
return (_singles);
}
public function getScore():uint{
return (_score);
}
private function setScope(_arg1:Event):void{
_scope = root;
if (_playerNum == 1){
_piecePreview = ((_scope.getNumPlayers())==2) ? _scope.menu_mc.small_preview1_mc : _scope.menu_mc.preview1_mc;
_scope.menu_mc.p1_lines.text = String(_lines);
_scope.menu_mc.p1_score.text = String(_score);
} else {
if (_playerNum == 2){
_piecePreview = _scope.menu_mc.small_preview2_mc;
_scope.menu_mc.p2_lines.text = String(_lines);
_scope.menu_mc.p2_score.text = String(_score);
};
};
}
private function everyFrame(_arg1:Event):void{
var _local2:uint;
var _local3:Object;
var _local4:Class;
var _local5:Boolean;
var _local6:*;
var _local7:uint;
if (_scope.isPaused()){
return;
};
_rotateFrameCounter++;
if (_rotateFrameCounter == _rotateFrameRate){
_rotateFrameCounter = 0;
if (((_rotate) && (!((_activePiece.getPieceNum() == 2))))){
_rotate = false;
_local4 = (getDefinitionByName(("Piece" + _activePiece.getPieceNum())) as Class);
_local6 = new (_local4);
_local6.setPieceNum(_activePiece.getPieceNum());
addChild(_local6);
_local6.rotation = (_activePiece.rotation + 90);
_local6.x = _activePiece.x;
_local6.y = _activePiece.y;
switch (_activePiece.getPieceNum()){
case 1:
if ((((_activePiece.rotation == 90)) && (!(isPositionAvailable(_local6))))){
_local6.x = (_local6.x - _blockLength);
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x + (_blockLength * 3));
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x - (_blockLength * 3));
_local6.y = (_local6.y - (_blockLength * 2));
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x + (_blockLength * 3));
_local6.y = (_local6.y + (_blockLength * 3));
if (!isPositionAvailable(_local6)){
removeChild(_local6);
_local6 = null;
};
};
};
};
} else {
if ((((_activePiece.rotation == 180)) && (!(isPositionAvailable(_local6))))){
_local6.x = (_local6.x + (_blockLength * 2));
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x - (_blockLength * 3));
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x + (_blockLength * 3));
_local6.y = (_local6.y - _blockLength);
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x - (_blockLength * 3));
_local6.y = (_local6.y + (_blockLength * 2));
if (!isPositionAvailable(_local6)){
removeChild(_local6);
_local6 = null;
};
};
};
};
} else {
if ((((_activePiece.rotation == -90)) && (!(isPositionAvailable(_local6))))){
_local6.x = (_local6.x - (_blockLength * 2));
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x + (_blockLength * 3));
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x - (_blockLength * 3));
_local6.y = (_local6.y - _blockLength);
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x + (_blockLength * 3));
_local6.y = (_local6.y + (_blockLength * 3));
if (!isPositionAvailable(_local6)){
removeChild(_local6);
_local6 = null;
};
};
};
};
} else {
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x - (_blockLength * 2));
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x + (_blockLength * 3));
if (!isPositionAvailable(_local6)){
_local6.y = (_local6.y - (_blockLength * 2));
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x - (_blockLength * 3));
_local6.y = (_local6.y + (_blockLength * 4));
if (!isPositionAvailable(_local6)){
removeChild(_local6);
_local6 = null;
};
};
};
};
};
};
};
};
break;
case 3:
if ((((_activePiece.rotation == 90)) && (!(isPositionAvailable(_local6))))){
_local6.x = (_local6.x + _blockLength);
if (!isPositionAvailable(_local6)){
_local6.y = (_local6.y - _blockLength);
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x - _blockLength);
_local6.y = (_local6.y - (_blockLength * 3));
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x + _blockLength);
if (!isPositionAvailable(_local6)){
removeChild(_local6);
_local6 = null;
};
};
};
};
} else {
if ((((_activePiece.rotation == 180)) && (!(isPositionAvailable(_local6))))){
_local6.x = (_local6.x + _blockLength);
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x - _blockLength);
_local6.y = (_local6.y + (_blockLength * 2));
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x + _blockLength);
if (!isPositionAvailable(_local6)){
removeChild(_local6);
_local6 = null;
};
};
};
} else {
if ((((_activePiece.rotation == -90)) && (!(isPositionAvailable(_local6))))){
_local6.x = (_local6.x - _blockLength);
if (!isPositionAvailable(_local6)){
_local6.y = (_local6.y + _blockLength);
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x + _blockLength);
_local6.y = (_local6.y - (_blockLength * 3));
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x - _blockLength);
if (!isPositionAvailable(_local6)){
removeChild(_local6);
_local6 = null;
};
};
};
};
} else {
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x - _blockLength);
if (!isPositionAvailable(_local6)){
_local6.y = (_local6.y - _blockLength);
if (!isPositionAvailable(_local6)){
_local6.y = (_local6.y - (_blockLength * 3));
if (!isPositionAvailable(_local6)){
removeChild(_local6);
_local6 = null;
};
};
};
};
};
};
};
break;
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
if ((((_activePiece.rotation == 90)) && (!(isPositionAvailable(_local6))))){
_local6.x = (_local6.x + _blockLength);
if (!isPositionAvailable(_local6)){
_local6.y = (_local6.y - _blockLength);
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x - _blockLength);
_local6.y = (_local6.y - (_blockLength * 3));
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x + _blockLength);
if (!isPositionAvailable(_local6)){
removeChild(_local6);
_local6 = null;
};
};
};
};
} else {
if ((((_activePiece.rotation == 180)) && (!(isPositionAvailable(_local6))))){
_local6.x = (_local6.x + _blockLength);
if (!isPositionAvailable(_local6)){
_local6.y = (_local6.y - _blockLength);
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x - _blockLength);
_local6.y = (_local6.y + (_blockLength * 3));
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x + _blockLength);
if (!isPositionAvailable(_local6)){
removeChild(_local6);
_local6 = null;
};
};
};
};
} else {
if ((((_activePiece.rotation == -90)) && (!(isPositionAvailable(_local6))))){
_local6.x = (_local6.x - _blockLength);
if (!isPositionAvailable(_local6)){
_local6.y = (_local6.y + _blockLength);
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x + _blockLength);
_local6.y = (_local6.y - (_blockLength * 3));
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x - _blockLength);
if (!isPositionAvailable(_local6)){
removeChild(_local6);
_local6 = null;
};
};
};
};
} else {
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x - _blockLength);
if (!isPositionAvailable(_local6)){
_local6.y = (_local6.y - _blockLength);
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x + _blockLength);
_local6.y = (_local6.y + (_blockLength * 3));
if (!isPositionAvailable(_local6)){
_local6.x = (_local6.x - _blockLength);
if (!isPositionAvailable(_local6)){
removeChild(_local6);
_local6 = null;
};
};
};
};
};
};
};
};
break;
};
if (_local6){
removeChild(_activePiece);
_local7 = _activePiece.getPieceNum();
_activePiece.removeEventListener(Event.ENTER_FRAME, everyFrame);
_local4 = (getDefinitionByName(("Piece" + _local7)) as Class);
_activePiece = new (_local4);
_activePiece.setPieceNum(_local7);
addChild(_activePiece);
_activePiece.addEventListener(Event.ENTER_FRAME, everyFrame);
_activePiece.rotation = _local6.rotation;
_activePiece.x = _local6.x;
_activePiece.y = _local6.y;
removeChild(_local6);
_local6 = null;
_local2 = 1;
while (_local2 <= 5) {
if (_activePiece[(("block" + _activePiece.getPieceNum()) + _local2)]){
_activePiece[(("block" + _activePiece.getPieceNum()) + _local2)].rotation = (_activePiece[(("block" + _activePiece.getPieceNum()) + _local2)].rotation - _activePiece.rotation);
};
_local2++;
};
_scope.playSound("Rotate");
};
};
};
if (_moveLeft){
_moveLeft = false;
movePiece("left");
};
if (_moveRight){
_moveRight = false;
movePiece("right");
};
_frameCounter++;
if (_frameCounter == _frameRate){
movePiece();
_frameCounter = 0;
};
if (_ghostPiece){
removeChild(_ghostPiece);
};
if (!_activePiece){
return;
};
_local4 = (getDefinitionByName(("GhostPiece" + _activePiece.getPieceNum())) as Class);
_ghostPiece = new (_local4);
_ghostPiece.setPieceNum(_activePiece.getPieceNum());
addChild(_ghostPiece);
_ghostPiece.rotation = _activePiece.rotation;
_ghostPiece.x = _activePiece.x;
_ghostPiece.y = _activePiece.y;
_local2 = 1;
while (_local2 <= 5) {
if (_ghostPiece[(("gblock" + _ghostPiece.getPieceNum()) + _local2)]){
_ghostPiece[(("gblock" + _ghostPiece.getPieceNum()) + _local2)].rotation = (_ghostPiece[(("gblock" + _ghostPiece.getPieceNum()) + _local2)].rotation - _ghostPiece.rotation);
};
_local2++;
};
_local5 = true;
while (_local5) {
_local2 = 1;
while (_local2 <= 5) {
if (!_ghostPiece[(("gblock" + _ghostPiece.getPieceNum()) + _local2)]){
} else {
_local3 = getBlockGridCoords(_ghostPiece[(("gblock" + _ghostPiece.getPieceNum()) + _local2)]);
if ((((_local3.y >= (_gridHeight + 1))) || (_grid[(_local3.y + 1)][_local3.x]))){
_local5 = false;
break;
};
};
_local2++;
};
if (_local5){
_ghostPiece.y = (_ghostPiece.y + 20);
};
};
}
private function fizzlePowerUp(_arg1:Event):void{
var _local2:uint;
var _local3:Block;
for (_local2 in _powerUpBlocks) {
if (_arg1.target == _powerUpBlocks[_local2]){
_powerUpBlocks.splice(_local2, 1);
break;
};
};
_local3 = _arg1.target._prevBlock;
addChild(_local3);
_local3.x = _arg1.target.x;
_local3.y = (_arg1.target._tween) ? _arg1.target._tween.finish : _arg1.target.y;
for (_local2 in _gridBlocks) {
if (_gridBlocks[_local2] == _arg1.target){
_gridBlocks[_local2] = _local3;
break;
};
};
_arg1.target.parent.removeChild(_arg1.target);
}
private function newPiece(_arg1:uint):void{
var _local2:uint;
var _local3:Class;
var _local4:Array;
var _local5:Boolean;
var _local6:Array;
var _local7:uint;
var _local8:String;
var _local9:Block;
var _local10:Boolean;
var _local11:uint;
_explosions = new Array();
_tweens = new Array();
_controlsDisabled = false;
_local3 = (getDefinitionByName(("Piece" + _arg1)) as Class);
_activePiece = new (_local3);
_activePiece.setPieceNum(_arg1);
addChild(_activePiece);
switch (_activePiece.getPieceNum()){
case 1:
_activePiece.x = 90;
_activePiece.y = 10;
break;
case 2:
_activePiece.x = 90;
_activePiece.y = -10;
break;
default:
_activePiece.x = 80;
_activePiece.y = 0;
break;
};
if (((0) && (!(isPositionAvailable(_activePiece))))){
_scope.endGame();
return;
};
_frameCounter = 0;
_activePiece.addEventListener(Event.ENTER_FRAME, everyFrame);
if (!_scope.isItemsEnabled()){
return;
};
if (((((_scope.randRange(0, 2)) || ((_gridBlocks.length < 15)))) || ((_powerUpBlocks.length >= 5)))){
return;
};
_local4 = new Array("Flip", "WeirdPiece", "Gravity", "ClearRow", "ClearColumn");
_local5 = false;
for (_local2 in _powerUpBlocks) {
if ((_powerUpBlocks[_local2] is (getDefinitionByName("actionscript.NukeBlock") as Class))){
_local5 = true;
break;
};
};
if (!_local5){
_local4.push("Nuke");
};
_local6 = new Array();
for (_local2 in _gridBlocks) {
_local10 = true;
for (_local11 in _powerUpBlocks) {
if (_powerUpBlocks[_local11] == _gridBlocks[_local2]){
_local10 = false;
};
};
if (_local10){
_local6.push(_gridBlocks[_local2]);
};
};
if (!_local6.length){
return;
};
_local7 = _scope.randRange(0, (_local6.length - 1));
_local8 = (_local4[_scope.randRange(0, (_local4.length - 1))] + "Block");
_local3 = (getDefinitionByName(_local8) as Class);
_local9 = new (_local3);
addChild(_local9);
_local9._prevBlock = _gridBlocks[_local7];
_local9.x = _gridBlocks[_local7].x;
_local9.y = (_gridBlocks[_local7]._tween) ? _gridBlocks[_local7]._tween.finish : _gridBlocks[_local7].y;
_gridBlocks[_local7].parent.removeChild(_gridBlocks[_local7]);
_gridBlocks[_local7] = _local9;
_powerUpBlocks.push(_local9);
_local9.addEventListener("fizzle", fizzlePowerUp);
}
private function triggerNuke():void{
var _local1:uint;
if (_ghostPiece){
removeChild(_ghostPiece);
_ghostPiece = null;
};
for (_local1 in _gridBlocks) {
_gridBlocks[_local1].remove();
};
_gridBlocks = new Array();
_powerUpBlocks = new Array();
_grid = freshGrid();
addChild(_explosionBitmap);
addChild(_renderSprite);
addChild(_renderSprite2);
addChild(_renderSprite3);
_explosions.push(new Explosion((this.width / 2), ((this.height * 2) / 7)));
_explosions.push(new Explosion((this.width / 2), ((this.height * 4) / 7)));
_explosions.push(new Explosion((this.width / 2), ((this.height * 6) / 7)));
startExplosionSound();
}
private function getBlockGridCoords(_arg1:Sprite):Object{
var _local2:Point;
var _local3:Object;
_local2 = new Point(_arg1.x, (_arg1._tween) ? _arg1._tween.finish : _arg1.y);
_local2 = _arg1.parent.localToGlobal(_local2);
_local2 = this.globalToLocal(_local2);
_local3 = new Object();
_local3.x = (_local2.x / _blockLength);
_local3.y = ((_local2.y / _blockLength) + 2);
return (_local3);
}
private function flashComplete(_arg1:TimerEvent):void{
var _local2:uint;
var _local3:Array;
var _local4:Array;
var _local5:uint;
var _local6:Boolean;
var _local7:Boolean;
_activePiece = null;
for (_local2 in _linesRemoved) {
clearRow(_linesRemoved[_local2]);
};
if (_linesRemoved.length){
_linesSinceChange = (_linesSinceChange + _linesRemoved.length);
if (_linesSinceChange >= 10){
changeLevel((_currentLevel + 1));
_linesSinceChange = (_linesSinceChange - 10);
};
setLines((_lines + _linesRemoved.length));
_local3 = new Array(40, 100, 300, 1200);
setScore((_score + ((_currentLevel + 1) * _local3[(_linesRemoved.length - 1)])));
switch (_linesRemoved.length){
case 4:
_tetrises++;
_scope.playSound("Tetris", 0.7);
_playerMsg = new Message("TETRIS", _playerNum);
_scope.addChild(_playerMsg);
_playerMsg.y = (_playerMsg.y + 100);
tetris_flash.gotoAndPlay(3);
break;
case 3:
_triples++;
_scope.playSound("LineMade", 0.5);
break;
case 2:
_doubles++;
_scope.playSound("LineMade", 0.5);
break;
case 1:
_singles++;
_scope.playSound("LineMade", 0.5);
break;
};
};
switch (_scope.getMode()){
case "challenge":
switch (_scope.getGame()){
case "lines40":
if (_lines >= 40){
_scope.endGame(_playerNum);
return;
};
break;
case "tetrises7":
if (_tetrises >= 7){
_scope.endGame(_playerNum);
return;
};
case "triples50":
if (_triples >= 50){
_scope.endGame(_playerNum);
return;
};
case "tetrises100":
if (_tetrises >= 100){
_scope.endGame(_playerNum);
return;
};
break;
};
break;
case "pattern":
switch (_scope.getGame()){
case "arrow":
_local4 = new Array(new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 1, 1, 1, 1, 1, 1, 1, 1, 1), new Array(1, 0, 1, 1, 1, 1, 1, 1, 1, 1), new Array(1, 1, 0, 1, 1, 1, 1, 1, 1, 1), new Array(1, 1, 1, 0, 1, 1, 1, 1, 1, 1), new Array(1, 1, 1, 1, 0, 1, 1, 1, 1, 1), new Array(1, 1, 1, 1, 1, 0, 1, 1, 1, 1), new Array(1, 1, 1, 1, 1, 1, 0, 1, 1, 1), new Array(1, 1, 1, 1, 1, 1, 1, 0, 1, 1), new Array(1, 1, 1, 1, 1, 1, 1, 1, 0, 1), new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 0), new Array(1, 1, 1, 1, 1, 1, 1, 1, 0, 1), new Array(1, 1, 1, 1, 1, 1, 1, 0, 1, 1), new Array(1, 1, 1, 1, 1, 1, 0, 1, 1, 1), new Array(1, 1, 1, 1, 1, 0, 1, 1, 1, 1), new Array(1, 1, 1, 1, 0, 1, 1, 1, 1, 1), new Array(1, 1, 1, 0, 1, 1, 1, 1, 1, 1), new Array(1, 1, 0, 1, 1, 1, 1, 1, 1, 1), new Array(1, 0, 1, 1, 1, 1, 1, 1, 1, 1), new Array(0, 1, 1, 1, 1, 1, 1, 1, 1, 1));
break;
case "floaters":
_local4 = new Array(new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(1, 1, 1, 1, 1, 1, 1, 0, 0, 0), new Array(1, 1, 1, 1, 1, 1, 1, 0, 1, 0), new Array(1, 1, 1, 1, 1, 1, 1, 0, 0, 0), new Array(1, 1, 1, 1, 1, 1, 1, 0, 1, 0), new Array(1, 1, 1, 1, 1, 1, 1, 0, 0, 0), new Array(1, 1, 1, 1, 1, 1, 1, 0, 1, 0), new Array(1, 1, 1, 1, 1, 1, 1, 0, 0, 0), new Array(1, 1, 1, 1, 1, 1, 1, 0, 1, 0), new Array(1, 1, 1, 1, 1, 1, 1, 0, 0, 0), new Array(1, 1, 1, 1, 1, 1, 1, 0, 1, 0), new Array(1, 1, 1, 1, 1, 1, 1, 0, 0, 0), new Array(1, 1, 1, 1, 1, 1, 1, 0, 1, 0), new Array(1, 1, 1, 1, 1, 1, 1, 0, 0, 0));
break;
case "negatives":
_local4 = new Array(new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(1, 0, 1, 1, 1, 1, 1, 1, 0, 0), new Array(0, 0, 1, 1, 0, 1, 1, 0, 0, 1), new Array(0, 1, 1, 0, 0, 0, 1, 1, 1, 1), new Array(1, 1, 1, 1, 1, 1, 1, 0, 1, 0), new Array(0, 1, 1, 0, 0, 1, 1, 0, 1, 0), new Array(0, 1, 1, 0, 0, 1, 0, 0, 1, 0), new Array(0, 0, 1, 1, 1, 1, 1, 1, 1, 0));
break;
};
_local2 = (_gridHeight + 1);
while (_local2 >= 0) {
_local7 = true;
for (j in _local4[_local2]) {
if (_local4[_local2][j]){
_local7 = false;
break;
};
};
if (_local7){
_local5 = _local2;
break;
};
_local2--;
};
_local6 = true;
_local2 = (_gridHeight + 1);
while (_local2 > _local5) {
for (j in _local4[_local2]) {
if (_local4[_local2][j] != _grid[_local2][j]){
_local6 = false;
break;
};
};
if (!_local6){
break;
};
_local2--;
};
if (_local6){
_scope.endGame(_playerNum);
return;
};
break;
};
if (_nuke){
triggerNuke();
return;
};
nextPowerUp();
}
private function setScore(_arg1:uint):void{
_score = _arg1;
_scope.menu_mc[(("p" + _playerNum) + "_score")].text = String(_score);
if (_score > _scope.getHighScore()){
_scope.setHighScore(_score);
};
}
public function removeHoldPiece():void{
if (_holdPiece){
_holdPiece.removeEventListener(Event.ENTER_FRAME, holdListener);
root.removeChild(_holdPiece);
_holdPiece = null;
};
}
public function getLines():uint{
return (_lines);
}
private function pullBlocksDown():void{
var _local1:uint;
var _local2:uint;
var _local3:Boolean;
var _local4:Object;
_local3 = false;
for (_local1 in _gridBlocks) {
_local4 = getBlockGridCoords(_gridBlocks[_local1]);
_local2 = (_gridHeight + 1);
while (_local2 > _local4.y) {
if (_grid[_local2][_local4.x]){
} else {
if (!_gridBlocks[_local1]._tween){
_gridBlocks[_local1].setTween(new Tween(_gridBlocks[_local1], Tweenables.Y, Strong.easeOut, _gridBlocks[_local1].y, (_gridBlocks[_local1].y + _blockLength), 0.5, true));
} else {
_gridBlocks[_local1]._tween.continueTo((_gridBlocks[_local1]._tween.finish + _blockLength), 0.5);
};
if (!_local3){
_gridBlocks[_local1]._tween.addEventListener(TweenEvent.MOTION_FINISH, pullFinished);
_local3 = true;
};
};
_local2--;
};
};
if (!_local3){
nextPowerUp();
};
}
private function explosionComplete(_arg1:Event):void{
removeChild(_explosionBitmap);
continuePieces();
}
public function holdPiece():void{
var _local1:uint;
var _local2:*;
var _local3:Class;
if (((((!(_holdAvailable)) || (!(_activePiece)))) || (_controlsDisabled))){
return;
};
_holdAvailable = false;
_local1 = 0;
if (_holdPiece){
_local1 = _holdPiece.getPieceNum();
removeHoldPiece();
};
_local2 = _activePiece.getPieceNum();
_local3 = (getDefinitionByName((("Piece" + _local2) + "NoPivot")) as Class);
_holdPiece = new (_local3);
_holdPiece.setPieceNum(_local2);
root.addChild(_holdPiece);
_holdPiece.scaleX = (_holdPiece.scaleY = 0.5);
_holdPiece.x = 25;
_holdPiece.y = 17;
_holdPiece.addEventListener(Event.ENTER_FRAME, holdListener);
_activePiece.removeEventListener(Event.ENTER_FRAME, everyFrame);
removeChild(_activePiece);
_activePiece = null;
if (!_local1){
_queuePosition++;
nextPiece();
return;
};
newPiece(_local1);
}
public function moveLeft():void{
_moveLeft = true;
}
private function flipFinish(_arg1:TweenEvent):void{
var _local2:uint;
var _local3:Array;
var _local4:uint;
var _local5:Object;
_local3 = freshGrid();
for (_local2 in _grid) {
for (_local4 in _grid[_local2]) {
_local3[_local2][((_gridWidth - 1) - _local4)] = _grid[_local2][_local4];
};
};
this.scaleX = 1;
this.x = ((_playerNum)==1) ? 14 : 316;
for (_local2 in _gridBlocks) {
_gridBlocks[_local2].scaleX = 1;
_local5 = getBlockGridCoords(_gridBlocks[_local2]);
_gridBlocks[_local2].x = (((_gridWidth - 1) - _local5.x) * _blockLength);
};
_grid = _local3;
nextPowerUp();
}
public function getTriples():uint{
return (_triples);
}
public function getQueuePosition():int{
return (_queuePosition);
}
private function freshGrid():Array{
return (new Array(new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)));
}
private function nextPiece():void{
_piecePreview.removePiece();
if (_nextPieceIsWeird){
_scope.getPiece(_queuePosition);
newPiece(_scope.randRange(8, 10));
_nextPieceIsWeird = false;
} else {
newPiece(_scope.getPiece(_queuePosition).getPieceNum());
};
}
public function changeLevel(_arg1:uint):void{
var _local2:uint;
var _local3:Array;
var _local4:uint;
var _local5:uint;
var _local6:Class;
var _local7:Block;
if (_arg1 > 9){
return;
};
if (((!(_queuePosition)) && ((_scope.getMode() == "regular")))){
_grid = new Array();
_local2 = 0;
while (_local2 <= ((_gridHeight + 1) - _arg1)) {
_grid[_local2] = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
_local2++;
};
while (_local2 <= (_gridHeight + 1)) {
_local3 = new Array();
_local4 = _scope.randRange(0, (_gridWidth - 1));
_local5 = 0;
while (_local5 <= (_gridWidth - 1)) {
if (_local4 == _local5){
_local3.push(0);
} else {
_local3.push(1);
_local6 = (getDefinitionByName(("Block" + _scope.randRange(1, 7))) as Class);
_local7 = new (_local6);
addChild(_local7);
_local7.x = (_local5 * _blockLength);
_local7.y = ((_local2 - 2) * _blockLength);
_gridBlocks.push(_local7);
};
_local5++;
};
_grid.push(_local3);
_local2++;
};
};
_currentLevel = _arg1;
_scope.menu_mc[(("p" + _playerNum) + "_level")].text = String(_currentLevel);
_frameRate = ((20 - (_currentLevel * 2)) - 1);
_playerMsg = new Message(("LEVEL " + _currentLevel), _playerNum);
_scope.addChild(_playerMsg);
_scope.playSound("LevelChange", 0.4);
}
public function movePiece(_arg1:String="down", _arg2=false):void{
var _local3:Boolean;
var _local4:Boolean;
var _local5:uint;
var _local6:Object;
var _local7:Number;
var _local8:Boolean;
var _local9:Sprite;
var _local10:Point;
var _local11:Class;
var _local12:MovieClip;
if (((!(_activePiece)) || (_controlsDisabled))){
return;
};
_arg1.toLowerCase();
_local3 = true;
_local4 = false;
_local5 = 1;
while (_local5 <= 5) {
if (!_activePiece[(("block" + _activePiece.getPieceNum()) + _local5)]){
} else {
_local6 = getBlockGridCoords(_activePiece[(("block" + _activePiece.getPieceNum()) + _local5)]);
switch (_arg1){
case "left":
if (((!(_local6.x)) || (_grid[_local6.y][(_local6.x - 1)]))){
_local3 = false;
};
break;
case "right":
if ((((_local6.x == 9)) || (_grid[_local6.y][(_local6.x + 1)]))){
_local3 = false;
};
break;
default:
if ((((_local6.y >= (_gridHeight + 1))) || (_grid[(_local6.y + 1)][_local6.x]))){
_local4 = true;
};
break;
};
};
_local5++;
};
if (_local4){
lockPiece();
return;
};
if (_local3){
switch (_arg1){
case "left":
_activePiece.x = (_activePiece.x - 20);
break;
case "right":
_activePiece.x = (_activePiece.x + 20);
break;
default:
if (_arg2){
_local7 = _activePiece.y;
_local8 = true;
while (_local8) {
_local5 = 1;
while (_local5 <= 5) {
if (!_activePiece[(("block" + _activePiece.getPieceNum()) + _local5)]){
} else {
_local6 = getBlockGridCoords(_activePiece[(("block" + _activePiece.getPieceNum()) + _local5)]);
if ((((_local6.y >= (_gridHeight + 1))) || (_grid[(_local6.y + 1)][_local6.x]))){
_local8 = false;
break;
};
};
_local5++;
};
if (_local8){
_activePiece.y = (_activePiece.y + 20);
};
};
_local5 = 1;
while (_local5 <= 5) {
if (!_activePiece[(("block" + _activePiece.getPieceNum()) + _local5)]){
} else {
_local9 = _activePiece[(("block" + _activePiece.getPieceNum()) + _local5)];
_local10 = new Point(_local9.x, _local9.y);
_local10 = _local9.parent.localToGlobal(_local10);
_local10 = this.globalToLocal(_local10);
_local11 = (getDefinitionByName(("Stream" + _activePiece.getPieceNum())) as Class);
_local12 = new (_local11);
addChild(_local12);
_local12.x = _local10.x;
_local12.y = _local7;
_local12.height = (_local10.y - _local7);
_local12.addEventListener(Event.ENTER_FRAME, streamFade);
};
_local5++;
};
_frameCounter = 0;
_scope.playSound("Drop");
} else {
_activePiece.y = (_activePiece.y + 20);
};
break;
};
};
}
private function isPositionAvailable(_arg1:Piece):Boolean{
var _local2:Boolean;
var _local3:uint;
var _local4:Object;
_local2 = true;
_local3 = 1;
while (_local3 <= 5) {
if (!_arg1[(("block" + _arg1.getPieceNum()) + _local3)]){
} else {
_local4 = getBlockGridCoords(_arg1[(("block" + _arg1.getPieceNum()) + _local3)]);
if ((((((((_local4.y > (_gridHeight + 1))) || ((_local4.x < 0)))) || ((_local4.x > 9)))) || (_grid[_local4.y][_local4.x]))){
_local2 = false;
break;
};
};
_local3++;
};
return (_local2);
}
private function setLines(_arg1:uint):void{
_lines = _arg1;
_scope.menu_mc[(("p" + _playerNum) + "_lines")].text = String(_lines);
if (_lines > _scope.getMostLines()){
_scope.setMostLines(_lines);
};
}
private function pullFinished(_arg1:TweenEvent):void{
var _local2:uint;
var _local3:uint;
var _local4:Array;
var _local5:Array;
var _local6:Array;
var _local7:Boolean;
_local4 = new Array();
_local2 = 0;
while (_local2 < _gridWidth) {
_local4[_local2] = 0;
_local2++;
};
for (_local2 in _grid) {
for (_local3 in _grid[_local2]) {
if (_grid[_local2][_local3]){
var _local12 = _local4;
var _local13 = _local3;
var _local14 = (_local12[_local13] + 1);
_local12[_local13] = _local14;
};
};
};
_local5 = freshGrid();
_local2 = (_gridHeight + 1);
while (_local2 >= 1) {
_local3 = 0;
while (_local3 < _gridWidth) {
if (_local4[_local3]){
_local5[_local2][_local3] = 1;
var _local8 = _local4;
var _local9 = _local3;
var _local10 = (_local8[_local9] - 1);
_local8[_local9] = _local10;
};
_local3++;
};
_local2--;
};
_grid = _local5;
_local6 = new Array();
for (_local2 in _grid) {
_local7 = true;
for (_local3 in _grid[_local2]) {
if (!_grid[_local2][_local3]){
_local7 = false;
break;
};
};
if (_local7){
_local6.push(_local2);
};
};
for (_local2 in _local6) {
clearRow(_local6[_local2]);
};
nextPowerUp();
}
private function startExplosionSound():void{
var _local1:Sound;
var _local2:SoundChannel;
var _local3:SoundTransform;
_local1 = new Explode();
_local2 = _local1.play();
_local3 = _local2.soundTransform;
_local3.volume = (_scope.isMuted()) ? 0 : 0.5;
_local2.soundTransform = _local3;
_local2.addEventListener(Event.SOUND_COMPLETE, explosionComplete);
}
public function getTetrises():uint{
return (_tetrises);
}
public function stopPieces():void{
if (_activePiece){
_activePiece.removeEventListener(Event.ENTER_FRAME, everyFrame);
};
}
}
}//package actionscript
Section 16
//WeirdPieceBlock (actionscript.WeirdPieceBlock)
package actionscript {
public class WeirdPieceBlock extends ItemBlock {
}
}//package actionscript
Section 17
//Tweenables (fl.motion.Tweenables)
package fl.motion {
public class Tweenables {
public static const SCALE_X:String = "scaleX";
public static const SCALE_Y:String = "scaleY";
public static const SKEW_X:String = "skewX";
public static const SKEW_Y:String = "skewY";
public static const X:String = "x";
public static const Y:String = "y";
public static const ROTATION:String = "rotation";
}
}//package fl.motion
Section 18
//Strong (fl.transitions.easing.Strong)
package fl.transitions.easing {
public class Strong {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return (((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 2)) + _arg2));
}
}
}//package fl.transitions.easing
Section 19
//Tween (fl.transitions.Tween)
package fl.transitions {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class Tween extends EventDispatcher {
private var _position:Number;// = NAN
public var prevTime:Number;// = NAN
public var prevPos:Number;// = NAN
public var isPlaying:Boolean;// = false
public var begin:Number;// = NAN
private var _fps:Number;// = NAN
private var _time:Number;// = NAN
public var change:Number;// = NAN
private var _finish:Number;// = NAN
public var looping:Boolean;// = false
private var _intervalID:uint;// = 0
public var func:Function;
private var _timer:Timer;// = null
private var _startTime:Number;// = NAN
public var prop:String;// = ""
private var _duration:Number;// = NAN
public var obj:Object;// = null
public var useSeconds:Boolean;// = false
protected static var _mc:MovieClip = new MovieClip();
public function Tween(_arg1:Object, _arg2:String, _arg3:Function, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean=false){
isPlaying = false;
obj = null;
prop = "";
func = function (_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
};
begin = NaN;
change = NaN;
useSeconds = false;
prevTime = NaN;
prevPos = NaN;
looping = false;
_duration = NaN;
_time = NaN;
_fps = NaN;
_position = NaN;
_startTime = NaN;
_intervalID = 0;
_finish = NaN;
_timer = null;
super();
if (!arguments.length){
return;
};
this.obj = _arg1;
this.prop = _arg2;
this.begin = _arg4;
this.position = _arg4;
this.duration = _arg6;
this.useSeconds = _arg7;
if ((_arg3 is Function)){
this.func = _arg3;
};
this.finish = _arg5;
this._timer = new Timer(100);
this.start();
}
public function continueTo(_arg1:Number, _arg2:Number):void{
this.begin = this.position;
this.finish = _arg1;
if (!isNaN(_arg2)){
this.duration = _arg2;
};
this.start();
}
public function stop():void{
this.stopEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_STOP, this._time, this._position));
}
private function fixTime():void{
if (this.useSeconds){
this._startTime = (getTimer() - (this._time * 1000));
};
}
public function set FPS(_arg1:Number):void{
var _local2:Boolean;
_local2 = this.isPlaying;
this.stopEnterFrame();
this._fps = _arg1;
if (_local2){
this.startEnterFrame();
};
}
public function get finish():Number{
return ((this.begin + this.change));
}
public function get duration():Number{
return (this._duration);
}
protected function startEnterFrame():void{
var _local1:Number;
if (isNaN(this._fps)){
_mc.addEventListener(Event.ENTER_FRAME, this.onEnterFrame, false, 0, true);
} else {
_local1 = (1000 / this._fps);
this._timer.delay = _local1;
this._timer.addEventListener(TimerEvent.TIMER, this.timerHandler, false, 0, true);
this._timer.start();
};
this.isPlaying = true;
}
public function set time(_arg1:Number):void{
this.prevTime = this._time;
if (_arg1 > this.duration){
if (this.looping){
this.rewind((_arg1 - this._duration));
this.update();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_LOOP, this._time, this._position));
} else {
if (this.useSeconds){
this._time = this._duration;
this.update();
};
this.stop();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_FINISH, this._time, this._position));
};
} else {
if (_arg1 < 0){
this.rewind();
this.update();
} else {
this._time = _arg1;
this.update();
};
};
}
protected function stopEnterFrame():void{
if (isNaN(this._fps)){
_mc.removeEventListener(Event.ENTER_FRAME, this.onEnterFrame);
} else {
this._timer.stop();
};
this.isPlaying = false;
}
public function getPosition(_arg1:Number=NaN):Number{
if (isNaN(_arg1)){
_arg1 = this._time;
};
return (this.func(_arg1, this.begin, this.change, this._duration));
}
public function set finish(_arg1:Number):void{
this.change = (_arg1 - this.begin);
}
public function set duration(_arg1:Number):void{
this._duration = ((_arg1)<=0) ? Infinity : _arg1;
}
public function setPosition(_arg1:Number):void{
this.prevPos = this._position;
if (this.prop.length){
this.obj[this.prop] = (this._position = _arg1);
};
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_CHANGE, this._time, this._position));
}
public function resume():void{
this.fixTime();
this.startEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_RESUME, this._time, this._position));
}
public function fforward():void{
this.time = this._duration;
this.fixTime();
}
protected function onEnterFrame(_arg1:Event):void{
this.nextFrame();
}
public function get position():Number{
return (this.getPosition(this._time));
}
public function yoyo():void{
this.continueTo(this.begin, this.time);
}
public function nextFrame():void{
if (this.useSeconds){
this.time = ((getTimer() - this._startTime) / 1000);
} else {
this.time = (this._time + 1);
};
}
protected function timerHandler(_arg1:TimerEvent):void{
this.nextFrame();
_arg1.updateAfterEvent();
}
public function get FPS():Number{
return (this._fps);
}
public function rewind(_arg1:Number=0):void{
this._time = _arg1;
this.fixTime();
this.update();
}
public function set position(_arg1:Number):void{
this.setPosition(_arg1);
}
public function get time():Number{
return (this._time);
}
private function update():void{
this.setPosition(this.getPosition(this._time));
}
public function start():void{
this.rewind();
this.startEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_START, this._time, this._position));
}
public function prevFrame():void{
if (!this.useSeconds){
this.time = (this._time - 1);
};
}
}
}//package fl.transitions
Section 20
//TweenEvent (fl.transitions.TweenEvent)
package fl.transitions {
import flash.events.*;
public class TweenEvent extends Event {
public var time:Number;// = NAN
public var position:Number;// = NAN
public static const MOTION_START:String = "motionStart";
public static const MOTION_STOP:String = "motionStop";
public static const MOTION_LOOP:String = "motionLoop";
public static const MOTION_CHANGE:String = "motionChange";
public static const MOTION_FINISH:String = "motionFinish";
public static const MOTION_RESUME:String = "motionResume";
public function TweenEvent(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Boolean=false){
time = NaN;
position = NaN;
super(_arg1, _arg4, _arg5);
this.time = _arg2;
this.position = _arg3;
}
override public function clone():Event{
return (new TweenEvent(this.type, this.time, this.position, this.bubbles, this.cancelable));
}
}
}//package fl.transitions
Section 21
//Challengescreen_88 (tetris_fla.Challengescreen_88)
package tetris_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Challengescreen_88 extends MovieClip {
public var lines40_btn:SimpleButton;
public var tetrises7_time:TextField;
public var tetrises7_btn:SimpleButton;
public var triples50_time:TextField;
public var tetrises100_btn:SimpleButton;
public var triples50_btn:SimpleButton;
public var lines40_time:TextField;
public var tetrises100_time:TextField;
}
}//package tetris_fla
Section 22
//Highscore_31 (tetris_fla.Highscore_31)
package tetris_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.system.*;
import flash.ui.*;
public dynamic class Highscore_31 extends MovieClip {
public var submit_name:TextField;
public var submit_btn:SimpleButton;
public var no_btn:SimpleButton;
public function Highscore_31(){
addFrameScript(0, frame1);
}
public function submitBtn(_arg1:MouseEvent):void{
if (submit_name.text){
root.submitHighScore(submit_name.text);
removeClip();
};
}
public function removeClip():void{
no_btn.removeEventListener(MouseEvent.CLICK, noBtn);
submit_btn.removeEventListener(MouseEvent.CLICK, submitBtn);
this.parent.removeChild(this);
}
function frame1(){
stage.focus = submit_name;
submit_name.text = root.getHighScoreName();
submit_name.setSelection(0, submit_name.length);
no_btn.addEventListener(MouseEvent.CLICK, noBtn);
submit_btn.addEventListener(MouseEvent.CLICK, submitBtn);
}
public function noBtn(_arg1:MouseEvent):void{
removeClip();
}
}
}//package tetris_fla
Section 23
//Menu_73 (tetris_fla.Menu_73)
package tetris_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.system.*;
import flash.ui.*;
public dynamic class Menu_73 extends MovieClip {
public var items_off_btn:SimpleButton;
public var unpause_btn:SimpleButton;
public var right_arrow:SimpleButton;
public var preview1_mc:Preview;
public var p2_lines:TextField;
public var playersSelected:uint;
public var startLevel:uint;
public var challenges:MovieClip;
public var best_score:TextField;
public var challenge_btn:SimpleButton;
public var player2_btn:SimpleButton;
public var pause_btn:SimpleButton;
public var p1_score:TextField;
public var p2_level:TextField;
public var unmute_btn:SimpleButton;
public var patterns:MovieClip;
public var small_preview1_mc:SmallPreview;
public var p1_lines:TextField;
public var controls1_2p:MovieClip;
public var back_btn:SimpleButton;
public var player1_btn:SimpleButton;
public var pattern_btn:SimpleButton;
public var mute_btn:SimpleButton;
public var regular_btn:SimpleButton;
public var most_lines:TextField;
public var timer:TextField;
public var help:MovieClip;
public var small_preview2_mc:SmallPreview;
public var items_on_btn:SimpleButton;
public var start_level:TextField;
public var controls2_2p:MovieClip;
public var controls1p:MovieClip;
public var p1_level:TextField;
public var mode:String;
public var left_arrow:SimpleButton;
public var p2_score:TextField;
public var game:String;
public function Menu_73(){
addFrameScript(0, frame1, 10, frame11, 20, frame21);
}
public function player2Button(_arg1:MouseEvent):void{
playersSelected = 2;
regular_btn.visible = (pattern_btn.visible = (challenge_btn.visible = (back_btn.visible = true)));
controls1_2p.visible = (controls2_2p.visible = true);
items_on_btn.visible = (items_off_btn.visible = false);
help.visible = false;
}
public function rightArrowClick(_arg1:MouseEvent):void{
startLevel++;
start_level.text = String(startLevel);
if (startLevel == 0){
left_arrow.visible = false;
} else {
if (startLevel == 9){
right_arrow.visible = false;
} else {
left_arrow.visible = (right_arrow.visible = true);
};
};
}
public function itemToggle(_arg1:MouseEvent):void{
this.parent.toggleItems();
if (this.parent.isItemsEnabled()){
items_off_btn.visible = false;
items_on_btn.visible = true;
} else {
items_on_btn.visible = false;
items_off_btn.visible = true;
};
}
function frame11(){
unpause_btn.visible = false;
unmute_btn.visible = root.isMuted();
mute_btn.visible = !(root.isMuted());
root.newGame(startLevel, 1, mode, game);
pause_btn.addEventListener(MouseEvent.CLICK, pauseButton);
unpause_btn.addEventListener(MouseEvent.CLICK, pauseButton);
mute_btn.addEventListener(MouseEvent.CLICK, muteButton);
unmute_btn.addEventListener(MouseEvent.CLICK, muteButton);
}
public function leftArrowClick(_arg1:MouseEvent):void{
startLevel--;
start_level.text = String(startLevel);
if (startLevel == 0){
left_arrow.visible = false;
} else {
if (startLevel == 9){
right_arrow.visible = false;
} else {
left_arrow.visible = (right_arrow.visible = true);
};
};
}
function frame1(){
stop();
playersSelected = 0;
challenges.visible = (patterns.visible = false);
regular_btn.visible = (pattern_btn.visible = (challenge_btn.visible = (back_btn.visible = false)));
controls1p.visible = (controls1_2p.visible = (controls2_2p.visible = false));
if (this.parent.isItemsEnabled()){
items_off_btn.visible = false;
} else {
items_on_btn.visible = false;
};
startLevel = root.getLastLevelStart();
start_level.text = String(startLevel);
most_lines.text = String(root.getMostLines());
best_score.text = String(root.getHighScore());
if (startLevel == 0){
left_arrow.visible = false;
} else {
if (startLevel == 9){
right_arrow.visible = false;
};
};
left_arrow.addEventListener(MouseEvent.CLICK, leftArrowClick);
right_arrow.addEventListener(MouseEvent.CLICK, rightArrowClick);
player1_btn.addEventListener(MouseEvent.CLICK, player1Button);
player2_btn.addEventListener(MouseEvent.CLICK, player2Button);
regular_btn.addEventListener(MouseEvent.CLICK, regularButton);
challenge_btn.addEventListener(MouseEvent.CLICK, challengeButton);
challenges.lines40_btn.addEventListener(MouseEvent.CLICK, lines40Button);
challenges.tetrises7_btn.addEventListener(MouseEvent.CLICK, tetrises7Button);
challenges.triples50_btn.addEventListener(MouseEvent.CLICK, triples50Button);
challenges.tetrises100_btn.addEventListener(MouseEvent.CLICK, tetrises100Button);
pattern_btn.addEventListener(MouseEvent.CLICK, patternButton);
patterns.arrow_btn.addEventListener(MouseEvent.CLICK, arrowButton);
patterns.negatives_btn.addEventListener(MouseEvent.CLICK, negativesButton);
patterns.floaters_btn.addEventListener(MouseEvent.CLICK, floatersButton);
items_on_btn.addEventListener(MouseEvent.CLICK, itemToggle);
items_off_btn.addEventListener(MouseEvent.CLICK, itemToggle);
back_btn.addEventListener(MouseEvent.CLICK, backButton);
}
function frame21(){
unpause_btn.visible = false;
unmute_btn.visible = root.isMuted();
mute_btn.visible = !(root.isMuted());
root.newGame(startLevel, 2, mode, game);
pause_btn.addEventListener(MouseEvent.CLICK, pauseButton);
unpause_btn.addEventListener(MouseEvent.CLICK, pauseButton);
mute_btn.addEventListener(MouseEvent.CLICK, muteButton);
unmute_btn.addEventListener(MouseEvent.CLICK, muteButton);
}
public function triples50Button(_arg1:MouseEvent):void{
game = "triples50";
gotoAndStop((playersSelected + "player"));
}
public function muteButton(_arg1:MouseEvent):void{
if (unmute_btn.visible){
unmute_btn.visible = false;
mute_btn.visible = true;
} else {
unmute_btn.visible = true;
mute_btn.visible = false;
};
root.toggleMute();
}
public function arrowButton(_arg1:MouseEvent):void{
game = "arrow";
gotoAndStop((playersSelected + "player"));
}
public function player1Button(_arg1:MouseEvent):void{
playersSelected = 1;
regular_btn.visible = (pattern_btn.visible = (challenge_btn.visible = (back_btn.visible = true)));
controls1p.visible = true;
items_on_btn.visible = (items_off_btn.visible = false);
help.visible = false;
}
public function lines40Button(_arg1:MouseEvent):void{
game = "lines40";
gotoAndStop((playersSelected + "player"));
}
public function pauseButton(_arg1:MouseEvent):void{
root.pauseGame();
}
public function patternButton(_arg1:MouseEvent):void{
challenges.visible = false;
if (mode == "pattern"){
mode = "";
patterns.visible = false;
return;
};
mode = "pattern";
patterns.visible = true;
}
public function backButton(_arg1:MouseEvent):void{
mode = "";
challenges.visible = (patterns.visible = false);
regular_btn.visible = (pattern_btn.visible = (challenge_btn.visible = (back_btn.visible = false)));
controls1p.visible = (controls1_2p.visible = (controls2_2p.visible = false));
help.visible = true;
if (this.parent.isItemsEnabled()){
items_off_btn.visible = false;
items_on_btn.visible = true;
} else {
items_on_btn.visible = false;
items_off_btn.visible = true;
};
}
public function floatersButton(_arg1:MouseEvent):void{
game = "floaters";
gotoAndStop((playersSelected + "player"));
}
public function challengeButton(_arg1:MouseEvent):void{
patterns.visible = false;
if (mode == "challenge"){
mode = "";
challenges.visible = false;
return;
};
challenges.lines40_time.text = root.getChallengeTime("lines40");
challenges.tetrises7_time.text = root.getChallengeTime("tetrises7");
challenges.triples50_time.text = root.getChallengeTime("triples50");
challenges.tetrises100_time.text = root.getChallengeTime("tetrises100");
mode = "challenge";
challenges.visible = true;
}
public function negativesButton(_arg1:MouseEvent):void{
game = "negatives";
gotoAndStop((playersSelected + "player"));
}
public function tetrises7Button(_arg1:MouseEvent):void{
game = "tetrises7";
gotoAndStop((playersSelected + "player"));
}
public function tetrises100Button(_arg1:MouseEvent):void{
game = "tetrises100";
gotoAndStop((playersSelected + "player"));
}
public function regularButton(_arg1:MouseEvent):void{
mode = "regular";
gotoAndStop((playersSelected + "player"));
}
}
}//package tetris_fla
Section 24
//Patternscreen_84 (tetris_fla.Patternscreen_84)
package tetris_fla {
import flash.display.*;
public dynamic class Patternscreen_84 extends MovieClip {
public var arrow_btn:SimpleButton;
public var floaters_btn:SimpleButton;
public var negatives_btn:SimpleButton;
}
}//package tetris_fla
Section 25
//Preloader_1 (tetris_fla.Preloader_1)
package tetris_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.system.*;
import flash.ui.*;
public dynamic class Preloader_1 extends MovieClip {
public var version;
public var upgrade:TextField;
public var download_btn:SimpleButton;
public var reqMinorVersion:uint;
public var buildNumber:String;
public var minorVersion:String;
public var reqMajorVersion:uint;
public var required:TextField;
public var reqBuildNumber:uint;
public var preload_bar:MovieClip;
public var majorVersion:String;
public function Preloader_1(){
addFrameScript(0, frame1, 1, frame2, 40, frame41);
}
public function preLoad(_arg1:Event):void{
preload_bar.scaleX = (loaderInfo.bytesLoaded / loaderInfo.bytesTotal);
if (preload_bar.scaleX == 1){
removeEventListener(Event.ENTER_FRAME, preLoad);
play();
};
}
public function clickDownload(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.adobe.com/go/getflashplayer"));
}
function frame1(){
stop();
reqMajorVersion = 9;
reqMinorVersion = 0;
reqBuildNumber = 45;
version = Capabilities.version.substr((Capabilities.version.lastIndexOf(" ") + 1));
majorVersion = version.substring(0, version.lastIndexOf(",", 1));
minorVersion = version.substring((version.lastIndexOf(",", 1) + 1), version.lastIndexOf(",", 3));
buildNumber = version.substring((version.lastIndexOf(",", 3) + 1), version.lastIndexOf(","));
if ((((Number(((majorVersion + ".") + minorVersion)) > Number(((reqMajorVersion + ".") + reqMinorVersion)))) || ((((Number(((majorVersion + ".") + minorVersion)) >= Number(((reqMajorVersion + ".") + reqMinorVersion)))) && ((buildNumber >= reqBuildNumber)))))){
gotoAndStop(2);
} else {
required.htmlText = (((((("All of my games require Adobe Flash Player " + reqMajorVersion) + ".") + reqMinorVersion) + ".") + reqBuildNumber) + " or above.");
upgrade.htmlText = (((((("Your Flash Player version is <font color=\"#54E422\">" + majorVersion) + ".") + minorVersion) + ".") + buildNumber) + "</font>. Click the link below to download and install the update.");
download_btn.addEventListener(MouseEvent.CLICK, clickDownload);
};
}
function frame2(){
stop();
addEventListener(Event.ENTER_FRAME, preLoad);
}
function frame41(){
stop();
root.gotoAndStop("game");
}
}
}//package tetris_fla
Section 26
//Soundsloader_51 (tetris_fla.Soundsloader_51)
package tetris_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.system.*;
import flash.ui.*;
public dynamic class Soundsloader_51 extends MovieClip {
public function Soundsloader_51(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package tetris_fla
Section 27
//Tetrisflash_27 (tetris_fla.Tetrisflash_27)
package tetris_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.system.*;
import flash.ui.*;
public dynamic class Tetrisflash_27 extends MovieClip {
public function Tetrisflash_27(){
addFrameScript(1, frame2, 24, frame25);
}
function frame25(){
stop();
}
function frame2(){
stop();
}
}
}//package tetris_fla
Section 28
//Beam (Beam)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.system.*;
import flash.ui.*;
public dynamic class Beam extends MovieClip {
public function Beam(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
this.parent.removeChild(this);
}
}
}//package
Section 29
//BeamSound (BeamSound)
package {
import flash.media.*;
public dynamic class BeamSound extends Sound {
}
}//package
Section 30
//Block1 (Block1)
package {
import actionscript.*;
public dynamic class Block1 extends Block {
}
}//package
Section 31
//Block2 (Block2)
package {
import actionscript.*;
public dynamic class Block2 extends Block {
}
}//package
Section 32
//Block3 (Block3)
package {
import actionscript.*;
public dynamic class Block3 extends Block {
}
}//package
Section 33
//Block4 (Block4)
package {
import actionscript.*;
public dynamic class Block4 extends Block {
}
}//package
Section 34
//Block5 (Block5)
package {
import actionscript.*;
public dynamic class Block5 extends Block {
}
}//package
Section 35
//Block6 (Block6)
package {
import actionscript.*;
public dynamic class Block6 extends Block {
}
}//package
Section 36
//Block7 (Block7)
package {
import actionscript.*;
public dynamic class Block7 extends Block {
}
}//package
Section 37
//Block8 (Block8)
package {
import actionscript.*;
public dynamic class Block8 extends Block {
}
}//package
Section 38
//ClearColumnBlock (ClearColumnBlock)
package {
import flash.display.*;
import flash.events.*;
import actionscript.*;
import flash.media.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.system.*;
import flash.ui.*;
public dynamic class ClearColumnBlock extends ClearColumnBlock {
public function ClearColumnBlock(){
addFrameScript(0, frame1, 18, frame19);
}
function frame1(){
stop();
}
function frame19(){
stop();
}
}
}//package
Section 39
//ClearRowBlock (ClearRowBlock)
package {
import flash.display.*;
import flash.events.*;
import actionscript.*;
import flash.media.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.system.*;
import flash.ui.*;
public dynamic class ClearRowBlock extends ClearRowBlock {
public function ClearRowBlock(){
addFrameScript(0, frame1, 18, frame19);
}
function frame1(){
stop();
}
function frame19(){
stop();
}
}
}//package
Section 40
//Drop (Drop)
package {
import flash.media.*;
public dynamic class Drop extends Sound {
}
}//package
Section 41
//Explode (Explode)
package {
import flash.media.*;
public dynamic class Explode extends Sound {
}
}//package
Section 42
//FlipBlock (FlipBlock)
package {
import flash.display.*;
import flash.events.*;
import actionscript.*;
import flash.media.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.system.*;
import flash.ui.*;
public dynamic class FlipBlock extends FlipBlock {
public function FlipBlock(){
addFrameScript(0, frame1, 18, frame19);
}
function frame1(){
stop();
}
function frame19(){
stop();
}
}
}//package
Section 43
//GameOver (GameOver)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.system.*;
import flash.ui.*;
public dynamic class GameOver extends MovieClip {
public var singles:TextField;
public var title:TextField;
public var tetrominoes:TextField;
public var per_minute:TextField;
public var tetrises:TextField;
public var score:TextField;
public var high_score:MovieClip;
public var doubles:TextField;
public var time:TextField;
public var play_btn:SimpleButton;
public var triples:TextField;
public var main_btn:SimpleButton;
public var lines:TextField;
public function GameOver(){
addFrameScript(0, frame1);
}
public function mainButton(_arg1:MouseEvent):void{
root.gotoAndStop("preloader");
root.clearScreen();
}
function frame1(){
play_btn.addEventListener(MouseEvent.CLICK, playButton);
main_btn.addEventListener(MouseEvent.CLICK, mainButton);
}
public function playButton(_arg1:MouseEvent):void{
root.newGame(root.getLastLevelStart(), root.getNumPlayers(), root.getMode(), root.getGame());
}
}
}//package
Section 44
//GhostBlock1 (GhostBlock1)
package {
import actionscript.*;
public dynamic class GhostBlock1 extends Block {
}
}//package
Section 45
//GhostBlock2 (GhostBlock2)
package {
import actionscript.*;
public dynamic class GhostBlock2 extends Block {
}
}//package
Section 46
//GhostBlock3 (GhostBlock3)
package {
import actionscript.*;
public dynamic class GhostBlock3 extends Block {
}
}//package
Section 47
//GhostBlock4 (GhostBlock4)
package {
import actionscript.*;
public dynamic class GhostBlock4 extends Block {
}
}//package
Section 48
//GhostBlock5 (GhostBlock5)
package {
import actionscript.*;
public dynamic class GhostBlock5 extends Block {
}
}//package
Section 49
//GhostBlock6 (GhostBlock6)
package {
import actionscript.*;
public dynamic class GhostBlock6 extends Block {
}
}//package
Section 50
//GhostBlock7 (GhostBlock7)
package {
import actionscript.*;
public dynamic class GhostBlock7 extends Block {
}
}//package
Section 51
//GhostBlock8 (GhostBlock8)
package {
import actionscript.*;
public dynamic class GhostBlock8 extends Block {
}
}//package
Section 52
//GhostPiece1 (GhostPiece1)
package {
import actionscript.*;
public dynamic class GhostPiece1 extends Piece {
}
}//package
Section 53
//GhostPiece10 (GhostPiece10)
package {
import actionscript.*;
public dynamic class GhostPiece10 extends Piece {
}
}//package
Section 54
//GhostPiece2 (GhostPiece2)
package {
import actionscript.*;
public dynamic class GhostPiece2 extends Piece {
}
}//package
Section 55
//GhostPiece3 (GhostPiece3)
package {
import actionscript.*;
public dynamic class GhostPiece3 extends Piece {
}
}//package
Section 56
//GhostPiece4 (GhostPiece4)
package {
import actionscript.*;
public dynamic class GhostPiece4 extends Piece {
}
}//package
Section 57
//GhostPiece5 (GhostPiece5)
package {
import actionscript.*;
public dynamic class GhostPiece5 extends Piece {
}
}//package
Section 58
//GhostPiece6 (GhostPiece6)
package {
import actionscript.*;
public dynamic class GhostPiece6 extends Piece {
}
}//package
Section 59
//GhostPiece7 (GhostPiece7)
package {
import actionscript.*;
public dynamic class GhostPiece7 extends Piece {
}
}//package
Section 60
//GhostPiece8 (GhostPiece8)
package {
import actionscript.*;
public dynamic class GhostPiece8 extends Piece {
}
}//package
Section 61
//GhostPiece9 (GhostPiece9)
package {
import actionscript.*;
public dynamic class GhostPiece9 extends Piece {
}
}//package
Section 62
//GravityBlock (GravityBlock)
package {
import flash.display.*;
import flash.events.*;
import actionscript.*;
import flash.media.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.system.*;
import flash.ui.*;
public dynamic class GravityBlock extends GravityBlock {
public function GravityBlock(){
addFrameScript(0, frame1, 18, frame19);
}
function frame1(){
stop();
}
function frame19(){
stop();
}
}
}//package
Section 63
//LevelChange (LevelChange)
package {
import flash.media.*;
public dynamic class LevelChange extends Sound {
}
}//package
Section 64
//LineMade (LineMade)
package {
import flash.media.*;
public dynamic class LineMade extends Sound {
}
}//package
Section 65
//Lock (Lock)
package {
import flash.media.*;
public dynamic class Lock extends Sound {
}
}//package
Section 66
//Music (Music)
package {
import flash.media.*;
public dynamic class Music extends Sound {
}
}//package
Section 67
//NukeBlock (NukeBlock)
package {
import flash.display.*;
import flash.events.*;
import actionscript.*;
import flash.media.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.system.*;
import flash.ui.*;
public dynamic class NukeBlock extends NukeBlock {
public function NukeBlock(){
addFrameScript(0, frame1, 18, frame19);
}
function frame1(){
stop();
}
function frame19(){
stop();
}
}
}//package
Section 68
//Piece1 (Piece1)
package {
import actionscript.*;
public dynamic class Piece1 extends Piece {
}
}//package
Section 69
//Piece10 (Piece10)
package {
import actionscript.*;
public dynamic class Piece10 extends Piece {
}
}//package
Section 70
//Piece10NoPivot (Piece10NoPivot)
package {
import actionscript.*;
public dynamic class Piece10NoPivot extends Piece {
}
}//package
Section 71
//Piece1NoPivot (Piece1NoPivot)
package {
import actionscript.*;
public dynamic class Piece1NoPivot extends Piece {
}
}//package
Section 72
//Piece2 (Piece2)
package {
import actionscript.*;
public dynamic class Piece2 extends Piece {
}
}//package
Section 73
//Piece2NoPivot (Piece2NoPivot)
package {
import actionscript.*;
public dynamic class Piece2NoPivot extends Piece {
}
}//package
Section 74
//Piece3 (Piece3)
package {
import actionscript.*;
public dynamic class Piece3 extends Piece {
}
}//package
Section 75
//Piece3NoPivot (Piece3NoPivot)
package {
import actionscript.*;
public dynamic class Piece3NoPivot extends Piece {
}
}//package
Section 76
//Piece4 (Piece4)
package {
import actionscript.*;
public dynamic class Piece4 extends Piece {
}
}//package
Section 77
//Piece4NoPivot (Piece4NoPivot)
package {
import actionscript.*;
public dynamic class Piece4NoPivot extends Piece {
}
}//package
Section 78
//Piece5 (Piece5)
package {
import actionscript.*;
public dynamic class Piece5 extends Piece {
}
}//package
Section 79
//Piece5NoPivot (Piece5NoPivot)
package {
import actionscript.*;
public dynamic class Piece5NoPivot extends Piece {
}
}//package
Section 80
//Piece6 (Piece6)
package {
import actionscript.*;
public dynamic class Piece6 extends Piece {
}
}//package
Section 81
//Piece6NoPivot (Piece6NoPivot)
package {
import actionscript.*;
public dynamic class Piece6NoPivot extends Piece {
}
}//package
Section 82
//Piece7 (Piece7)
package {
import actionscript.*;
public dynamic class Piece7 extends Piece {
}
}//package
Section 83
//Piece7NoPivot (Piece7NoPivot)
package {
import actionscript.*;
public dynamic class Piece7NoPivot extends Piece {
}
}//package
Section 84
//Piece8 (Piece8)
package {
import actionscript.*;
public dynamic class Piece8 extends Piece {
}
}//package
Section 85
//Piece8NoPivot (Piece8NoPivot)
package {
import actionscript.*;
public dynamic class Piece8NoPivot extends Piece {
}
}//package
Section 86
//Piece9 (Piece9)
package {
import actionscript.*;
public dynamic class Piece9 extends Piece {
}
}//package
Section 87
//Piece9NoPivot (Piece9NoPivot)
package {
import actionscript.*;
public dynamic class Piece9NoPivot extends Piece {
}
}//package
Section 88
//PlayArea (PlayArea)
package {
import actionscript.*;
public dynamic class PlayArea extends Player {
}
}//package
Section 89
//Preview (Preview)
package {
import actionscript.*;
public dynamic class Preview extends PiecePreview {
}
}//package
Section 90
//Rotate (Rotate)
package {
import flash.media.*;
public dynamic class Rotate extends Sound {
}
}//package
Section 91
//SmallPreview (SmallPreview)
package {
import actionscript.*;
public dynamic class SmallPreview extends PiecePreview {
}
}//package
Section 92
//Stream1 (Stream1)
package {
import flash.display.*;
public dynamic class Stream1 extends MovieClip {
}
}//package
Section 93
//Stream10 (Stream10)
package {
import flash.display.*;
public dynamic class Stream10 extends MovieClip {
}
}//package
Section 94
//Stream2 (Stream2)
package {
import flash.display.*;
public dynamic class Stream2 extends MovieClip {
}
}//package
Section 95
//Stream3 (Stream3)
package {
import flash.display.*;
public dynamic class Stream3 extends MovieClip {
}
}//package
Section 96
//Stream4 (Stream4)
package {
import flash.display.*;
public dynamic class Stream4 extends MovieClip {
}
}//package
Section 97
//Stream5 (Stream5)
package {
import flash.display.*;
public dynamic class Stream5 extends MovieClip {
}
}//package
Section 98
//Stream6 (Stream6)
package {
import flash.display.*;
public dynamic class Stream6 extends MovieClip {
}
}//package
Section 99
//Stream7 (Stream7)
package {
import flash.display.*;
public dynamic class Stream7 extends MovieClip {
}
}//package
Section 100
//Stream8 (Stream8)
package {
import flash.display.*;
public dynamic class Stream8 extends MovieClip {
}
}//package
Section 101
//Stream9 (Stream9)
package {
import flash.display.*;
public dynamic class Stream9 extends MovieClip {
}
}//package
Section 102
//Tetris (Tetris)
package {
import flash.media.*;
public dynamic class Tetris extends Sound {
}
}//package
Section 103
//WeirdPieceBlock (WeirdPieceBlock)
package {
import flash.display.*;
import flash.events.*;
import actionscript.*;
import flash.media.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.system.*;
import flash.ui.*;
public dynamic class WeirdPieceBlock extends WeirdPieceBlock {
public function WeirdPieceBlock(){
addFrameScript(0, frame1, 18, frame19);
}
function frame1(){
stop();
}
function frame19(){
stop();
}
}
}//package