部分源码如下

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:mx="library://ns.adobe.com/flex/mx" frameRate="30" fontSize="16" width="480" height="600" layout="vertical" paddingBottom="0" paddingLeft="0" paddingRight="0" paddingTop="0" creationComplete="created(event)">
    <mx:HBox width="100%" height="100%">
        <mx:UIComponent id="gameContainer" width="300"></mx:UIComponent>
        <mx:VBox width="100%" height="100%" horizontalAlign="center" paddingBottom="5" paddingTop="5">
            <mx:Label text="Score: {score}"/>
            <mx:Box height="100%"/>
            <mx:LinkButton label="https://yunp.top" click="navigateToURL(new URLRequest('https://yunp.top'),'_top')"/>
            <mx:Box height="100%"/>
            <mx:Button label="Up" width="65" height="40" click="game.rotateTetromino()"/>
            <mx:HBox>
                <mx:Button label="Left" width="65" height="40" click="game.moveTetromino(-1,0)"/>
                <mx:Button label="Right" width="65" height="40" click="game.moveTetromino(1,0)"/>
            </mx:HBox>
            <mx:Button label="Down" width="65" height="40" click="game.moveTetromino(0,1)"/>
        </mx:VBox>
    </mx:HBox>

    <fx:Script>
        <![CDATA[
            import flash.events.Event;
            import com.topyunp.tetris.TetrisGame;
            import com.topyunp.tetris.TetrisGameEvent;
            import flash.net.navigateToURL;
            import flash.net.URLRequest;
            import mx.controls.Alert;
            
            private var game:TetrisGame;
            
            private function created(event:Event):void
            {
                game = new TetrisGame();
                game.addEventListener(TetrisGameEvent.CLEAR_FULL_ROW, clearFullRowHandler);
                game.addEventListener(TetrisGameEvent.GAME_OVER, gameOverHandler);
                gameContainer.addChild(game);
            }
            
            private function clearFullRowHandler(e:TetrisGameEvent):void
            {
                score += 1;
            }
            
            private function gameOverHandler(event:TetrisGameEvent):void
            {
                Alert.show("Game over, click [OK] to restart game", "Tetris", 4, null, function(event:*):void
                    {
                        score = 0;
                        game.startNewGame();
                    }
                );
            }
            
            [Bindable]
            public var score:int = 0;
        ]]>
    </fx:Script>

</mx:Application>