notice: Flash editor updated! Join the development! Thanks to MiniBuilder


embed

FAVORITE BY
:
gameso fun!!
:
STAGE9, 10がもう無理ゲー
:
:
:
EVIL GAME :)
:
:
shmupkenta cho insanity
:
:
gameおもしろ
:
gameyabai
:
ショット形状を覚えて回避/撃墜しやすい動きを考えるのが楽しい.
:
:
FORKED
  1. //   Fire / Start : [Z], [X], [.] or [/] key.
  2. package {
  3.     import flash.display.Sprite;
  4.     [SWF(width="465", height="465", backgroundColor="0xffffff", frameRate="30")]
  5.     public class blob extends Sprite {
  6.         public function blob() { main = this; initialize(); }
  7.     }
  8. }
  9. import flash.display.*;
  10. import flash.geom.*;
  11. import flash.text.*;
  12. import flash.events.*;
  13. const SCREEN_WIDTH:int = 465, SCREEN_HEIGHT:int = 465;
  14. var main:Sprite, g:Graphics;
  15. var keys:Vector.<Boolean> = new Vector.<Boolean>(256);
  16. var gravity:Number = 0.1;
  17. var epi:MovieClip = new center_node();
  18.     
  19. function initialize():void {
  20.     main.addEventListener(Event.ENTER_FRAME,mainLoop);
  21.     
  22.     main.addChild(epi);
  23.     epi.x = 200;
  24.     epi.y = 200;
  25.     createNodes(15,30,epi);
  26. }
  27. function createNodes(n:Number,r:Number,center:MovieClip):void{
  28.     var sn:Number = n;
  29.     var angle:Number  =0;
  30.     var angleInc:Number = ((Math.PI)*2)/n;
  31.     while(n>0){
  32.         var o_node:MovieClip = new outer_node();
  33.         main.addChild(o_node);
  34.         o_node.epi = center;
  35.         center.o_nodes.push(o_node);
  36.             
  37.         o_node.x = (Math.cos(angle)*r)+center.x;
  38.         o_node.y = (Math.sin(angle)*r)+center.y;
  39.         angle+=angleInc;
  40.         n--;
  41.     }
  42.     
  43.     n = 0;
  44.     while(n<sn){
  45.         var A:Number = n-1;
  46.         if(A<0){A=sn-1;}
  47.         var B:Number = n+1;
  48.         if(B>=sn){B = 0;}
  49.         center.o_nodes[n].springNodeA = center.o_nodes[A];
  50.         center.o_nodes[n].springNodeB = center.o_nodes[B];
  51.         n++;
  52.     }
  53. }
  54. function mainLoop(e:Event):void{
  55.     epi.update();
  56. }
  57. /////////////////////////////////////////////////////////////////////////////////
  58. class outer_node extends MovieClip {
  59.     public var vx:Number = 0;
  60.     public var vy:Number = 0;
  61.     public var epi:MovieClip;
  62.     public var mass:Number = 3;
  63.     public var springNodeA:MovieClip;
  64.     public var springNodeB:MovieClip;
  65.         public function outer_node(){
  66.             graphics.beginFill(0x111111,1);
  67.             graphics.drawCircle(0,0,3);
  68.             graphics.endFill();
  69.         }
  70.         
  71.         public function update():void{
  72.             vy+=gravity;
  73.             
  74.             //spring away from center
  75.             var dx:Number = epi.x - x;
  76.             var dy:Number = epi.y - y;
  77.             var d:Number = Math.sqrt(dx*dx+dy*dy);
  78.             if(dx==0){dx = 0.0001;}
  79.             if(d==0){d = 0.0001;}
  80.             var xtoy:Number = dy/dx;
  81.             var dtox:Number = dx/d;
  82.             var f:Number = (20/d)/mass;
  83.             //f/m =a 
  84.             var newDx:Number = f*dtox;
  85.             var newDy:Number = newDx*xtoy;
  86.             vx-=newDx;
  87.             vy-=newDy;
  88.         
  89.         
  90.             //spring to paired node
  91.             dx = springNodeA.x - x;
  92.             dy = springNodeA.y - y;
  93.             d = Math.sqrt(dx*dx+dy*dy);
  94.             if(dx==0){dx = 0.0001;}
  95.             if(d==0){d = 0.0001;}
  96.             xtoy = dy/dx;
  97.             dtox = dx/d;
  98.             f = (20/d)/mass;
  99.             //f/m =a 
  100.             newDx = f*dtox;
  101.             newDy = newDx*xtoy;
  102.             //vx+=newDx;
  103.             //vy+=newDy;
  104.             
  105.             //spring to B
  106.             dx = springNodeB.x - x;
  107.             dy = springNodeB.y - y;
  108.             d = Math.sqrt(dx*dx+dy*dy);
  109.             if(dx==0){dx = 0.0001;}
  110.             if(d==0){d = 0.0001;}
  111.             xtoy = dy/dx;
  112.             dtox = dx/d;
  113.             f = (20/d)/mass;
  114.             //f/m =a 
  115.             newDx = f*dtox;
  116.             newDy = newDx*xtoy;
  117.             //vx+=newDx;
  118.             //vy+=newDy;
  119.                         
  120.             x+=vx;
  121.             y+=vy;
  122.             if(y+width/2>465){
  123.                 y=465-width/2;
  124.                 vy *= -0.4;
  125.             }
  126.             if(x+width/2>465){
  127.                 x=465-width/2;
  128.                 vx *= -0.4;
  129.             }
  130.             if(x-width/2<0){
  131.                 x=width/2;
  132.                 vx *= -0.4;
  133.             }
  134.         }
  135. }
  136. class center_node extends MovieClip {
  137.     public var vx:Number = 0;
  138.     public var vy:Number = 0;
  139.     public var o_nodes:Array = new Array();
  140.     public var mass:Number = 10;
  141.         public function center_node():void{
  142.             graphics.beginFill(0x000000,1);
  143.             graphics.drawCircle(0,0,7);
  144.             graphics.endFill();
  145.         }
  146.         
  147.         public function update():void{
  148.             vy+=gravity;
  149.             
  150.             updateNodes();
  151.             
  152.             x+=vx;
  153.             y+=vy;
  154.             if(y+width/2>465){
  155.                 y=465-width/2;
  156.                 vy *= -0.4;
  157.             }
  158.             
  159.             if(x+width/2>465){
  160.                 x=465-width/2;
  161.                 vx *= -0.4;
  162.             }
  163.         }
  164.         
  165.         private function updateNodes():void{
  166.             var i:Number = o_nodes.length-1;
  167.             while(i>=0){
  168.                 var cur_o_nodes:MovieClip = o_nodes[i];
  169.                 cur_o_nodes.update();
  170.                 i--;
  171.             }
  172.         }
  173. }
noswf
  1. // forked from ABA's DefeatMe
  2. // DefeatMe.as
  3. //  Defeat black ships.
  4. //  (To restart from stage 1, reload the page.)
  5. //  <Operation>
  6. //   Movement     : Arrow or [WASD] keys.
  7. //   Fire / Start : [Z], [X], [.] or [/] key.
  8. package {
  9.     import flash.display.Sprite;
  10.     [SWF(width="465", height="465", backgroundColor="0xdddddd", frameRate="30")]
  11.     public class DefeatMe extends Sprite {
  12.         public function DefeatMe() { main = this; initialize(); }
  13.     }
  14. }
  15. import flash.display.*;
  16. import flash.geom.*;
  17. import flash.text.*;
  18. import flash.events.*;
  19. const SCREEN_WIDTH:int = 465, SCREEN_HEIGHT:int = 465;
  20. var main:Sprite, g:Graphics;
  21. var messageField:TextField = new TextField;
  22. var keys:Vector.<Boolean> = new Vector.<Boolean>(256);
  23. // Initialize UIs.
  24. function initialize():void {
  25.     g = main.graphics;
  26.     main.stage.addEventListener(KeyboardEvent.KEY_DOWN, function(e:KeyboardEvent):void { keys[e.keyCode] = true; } );
  27.     main.stage.addEventListener(KeyboardEvent.KEY_UP,   function(e:KeyboardEvent):void { keys[e.keyCode] = false; } );
  28.     messageField = createTextField(SCREEN_WIDTH - 360, SCREEN_HEIGHT - 20360200);
  29.     main.addChild(messageField);
  30.     goToNextStage(); ships[1].exists = false;
  31.     startGameOver(); gameOverTicks = 1;
  32.     main.addEventListener(Event.ENTER_FRAME, update);
  33. }
  34. // Update the game frame.
  35. function update(event:Event):void {
  36.     g.clear(); g.lineStyle(500.8);
  37.     var isStageOver:Boolean = true;
  38.     for each (var s:Ship in ships) {
  39.         s.update();
  40.         if (!s.isPlayer && s.exists) isStageOver = false;
  41.     }
  42.     for (var i:int = 0; i < shots.length; i++) if (!shots[i].update()) { shots.splice(i, 1); i--; }
  43.     if (isInGame) {
  44.         if (isStageOver) goToNextStage();
  45.     } else {
  46.         if (gameOverTicks > 0) {
  47.             gameOverTicks--; messageField.y = SCREEN_HEIGHT - 20 + gameOverTicks;
  48.         } else if (isFirePressed()) {
  49.             isInGame = true; resetStage();
  50.         }
  51.     }
  52. }
  53. var firePressedFlag:Boolean;
  54. function isFirePressed():Boolean {
  55.     if (keys[0x5a] || keys[0xbf] || keys[0x58] || keys[0xbe]) {
  56.         if (!firePressedFlag) {
  57.             firePressedFlag = true;
  58.             return true;
  59.         }
  60.     } else {
  61.         firePressedFlag = false;
  62.     }
  63.     return false;
  64. }
  65. // Ships.
  66. var ships:Vector.<Ship> = new Vector.<Ship>;
  67. class Ship {
  68.     public var pos:Vector3D;
  69.     public var isPlayer:Boolean;
  70.     public var posRecord:Vector.<Vector3D>;
  71.     public var fireRecord:Vector.<Boolean>;
  72.     public var recordIndex:int = 0;
  73.     public var exists:Boolean = true;
  74.     public var speed:Number = 5, shotSpeed:Number = 10;
  75.     public var fireWay:int = 1, fireWayAngle:Number = PI / 5;
  76.     public function update():void {
  77.         if (!exists) return;
  78.         if (isPlayer) { updatePlayer(); return; }
  79.         pos = posRecord[recordIndex];
  80.         if (fireRecord[recordIndex]) addShot(pos, shotSpeed, fireWay, fireWayAngle, false);
  81.         recordIndex++; if (recordIndex >= fireRecord.length) recordIndex = 0;
  82.         g.moveTo(pos.x, pos.y + 10);
  83.         g.lineTo(pos.x - 7, pos.y - 4);
  84.         g.lineTo(pos.x + 7, pos.y - 4);
  85.         g.lineTo(pos.x, pos.y + 10);
  86.         return;
  87.     }
  88.     public function updatePlayer():void {
  89.         var vx:Number = 0, vy:Number = 0;
  90.         if (keys[0x25] || keys[0x41]) vx = -1;
  91.         if (keys[0x26] || keys[0x57]) vy = -1;
  92.         if (keys[0x27] || keys[0x44]) vx =  1;
  93.         if (keys[0x28] || keys[0x53]) vy =  1;
  94.         var isFiring:Boolean = isFirePressed();
  95.         if (isFiring) addShot(pos, shotSpeed, fireWay, fireWayAngle, true);
  96.         if (vx != 0 && vy != 0) { vx *= 0.7; vy *= 0.7; }
  97.         pos.x += vx * speed; pos.y += vy * speed;
  98.         if (pos.x < 10) pos.x = 10;
  99.         else if (pos.x > SCREEN_WIDTH - 10) pos.x = SCREEN_WIDTH - 10;
  100.         if (pos.y < 10) pos.y = 10;
  101.         else if (pos.y > SCREEN_HEIGHT - 10) pos.y = SCREEN_HEIGHT - 10;
  102.         g.moveTo(pos.x, pos.y - 10);
  103.         g.lineTo(pos.x - 7, pos.y + 4);
  104.         g.lineTo(pos.x + 7, pos.y + 4);
  105.         g.lineTo(pos.x, pos.y - 10);
  106.         var p:Vector3D = new Vector3D(pos.x, -(pos.y - SCREEN_HEIGHT * 0.5) + SCREEN_HEIGHT * 0.5);
  107.         posRecord.push(p); fireRecord.push(isFiring);
  108.     }
  109.     public function checkHit(p:Vector3D):Boolean {
  110.         if (!exists) return false;
  111.         var isHit:Boolean = (Vector3D.distance(p, pos) < 15);
  112.         if (isHit) {
  113.             exists = false;
  114.             if (isPlayer) startGameOver();
  115.         }
  116.         return isHit;
  117.     }
  118. }
  119. function goToNextStage():void {
  120.     var s:Ship;
  121.     if (ships.length > 0) {
  122.         ships[ships.length - 1].isPlayer = false;
  123.     } else {
  124.         s = new Ship;
  125.         var p:Vector3D = new Vector3D(SCREEN_WIDTH * 0.5, SCREEN_HEIGHT * 0.25);
  126.         s.posRecord = new Vector.<Vector3D>;
  127.         s.fireRecord = new Vector.<Boolean>;
  128.         s.posRecord.push(p); s.fireRecord.push(false);
  129.         ships.push(s);
  130.     }
  131.     var sn:int = ships.length;
  132.     s = new Ship;
  133.     s.pos = new Vector3D;
  134.     if (sn % 3 == 0) s.shotSpeed += 3;
  135.     if (sn % 5 == 0) s.shotSpeed += 2;
  136.     if (sn % 3 == 2) s.fireWay += 2;
  137.     if (sn % 4 == 0) s.fireWay++;
  138.     if (sn % 5 == 4) s.fireWay++;
  139.     if (sn % 2 == 0) s.fireWayAngle *= 0.7;
  140.     if (sn % 4 == 2) s.fireWayAngle *= 0.8;
  141.     if (sn % 4 == 3) s.speed *= 1.4;
  142.     s.isPlayer = true;
  143.     ships.push(s);
  144.     resetStage();
  145. }
  146. function resetStage():void {
  147.     var sn:int = ships.length - 1;
  148.     var s:Ship;
  149.     for each (s in ships) { s.recordIndex = 0; s.exists = true; }
  150.     shots = null; shots = new Vector.<Shot>;
  151.     s = ships[ships.length - 1];
  152.     s.pos.x = SCREEN_WIDTH * 0.5; s.pos.y = SCREEN_WIDTH * 0.75;
  153.     s.posRecord = null; s.posRecord = new Vector.<Vector3D>;
  154.     s.fireRecord = null; s.fireRecord = new Vector.<Boolean>;
  155.     for (var x:int = 0; x <= SCREEN_WIDTH; x += 15) {
  156.         addShot(new Vector3D(x, 30), 5.0 / (sn + 1), 10false);
  157.     }
  158.     messageField.y = 0;
  159.     messageField.text = "Stage " + sn;
  160. }
  161. // Shots.
  162. var shots:Vector.<Shot>;
  163. class Shot {
  164.     public var pos:Vector3D = new Vector3D, vel:Vector3D = new Vector3D;
  165.     public var isPlayersShot:Boolean;
  166.     public function update():Boolean {
  167.         pos.incrementBy(vel);
  168.         g.moveTo(pos.x, pos.y - 10);
  169.         g.lineTo(pos.x, pos.y + 10);
  170.         if (isPlayersShot) {
  171.             for each (var s:Ship in ships) if (!s.isPlayer) if (s.checkHit(pos)) return false;
  172.         } else {
  173.             ships[ships.length - 1].checkHit(pos);
  174.         }
  175.         return (pos.x >= 0 && pos.x < SCREEN_WIDTH && pos.y >= 0 && pos.y < SCREEN_HEIGHT);
  176.     }
  177. }
  178. function addShot(p:Vector3D, shotSpeed:Number, fireWay:int, fireWayAngle:Number, isPlayer:Boolean):void {
  179.     var s:Shot, a:Number = 0, ai:Number;
  180.     if (fireWay > 1) {
  181.         a = -fireWayAngle;
  182.         ai = fireWayAngle * 2 / (fireWay - 1);
  183.     }
  184.     for (var i:int = 0; i < fireWay; i++) {
  185.         s = new Shot;
  186.         s.pos.x = p.x; s.pos.y = p.y;
  187.         var sa:Number = a;
  188.         if (isPlayer) sa = PI - a;
  189.         s.vel.x = shotSpeed * sin(sa); s.vel.y = shotSpeed * cos(sa);
  190.         s.isPlayersShot = isPlayer;
  191.         shots.push(s);
  192.         a += ai;
  193.     }
  194. }
  195. // Handle the game lifecycle.
  196. var isInGame:Boolean, gameOverTicks:int;
  197. function startGameOver():void {
  198.     isInGame = false; gameOverTicks = 20;
  199.     messageField.text = "GAME OVER";
  200. }
  201. // Utility functions and variables.
  202. var sin:Function = Math.sin, cos:Function = Math.cos, PI:Number = Math.PI;
  203. function createTextField(x:int, y:int, width:int, size:int, color:int):TextField {
  204.     var fm:TextFormat = new TextFormat, fi:TextField = new TextField;
  205.     fm.font = "_typewriter"; fm.bold = true; fm.size = size; fm.color = color; fm.align = TextFormatAlign.RIGHT;
  206.     fi.defaultTextFormat = fm; fi.x = x; fi.y = y; fi.width = width; fi.selectable = false;
  207.     return fi;
  208. }
noswf
  1. // forked from ABA's DefeatMe
  2. // DefeatMe.as
  3. //  Defeat black ships.
  4. //  (To restart from stage 1, reload the page.)
  5. //  <Operation>
  6. //   Movement     : Arrow or [WASD] keys.
  7. //   Fire / Start : [Z], [X], [.] or [/] key.
  8. package {
  9.     import flash.display.Sprite;
  10.     [SWF(width="465", height="465", backgroundColor="0xdddddd", frameRate="30")]
  11.     public class DefeatMe extends Sprite {
  12.         public function DefeatMe() { main = this; initialize(); }
  13.     }
  14. }
  15. import flash.display.*;
  16. import flash.geom.*;
  17. import flash.text.*;
  18. import flash.events.*;
  19. const SCREEN_WIDTH:int = 465, SCREEN_HEIGHT:int = 465;
  20. var main:Sprite, g:Graphics;
  21. var messageField:TextField = new TextField;
  22. var keys:Vector.<Boolean> = new Vector.<Boolean>(256);
  23. // Initialize UIs.
  24. function initialize():void {
  25.     g = main.graphics;
  26.     main.stage.addEventListener(KeyboardEvent.KEY_DOWN, function(e:KeyboardEvent):void { keys[e.keyCode] = true; } );
  27.     main.stage.addEventListener(KeyboardEvent.KEY_UP,   function(e:KeyboardEvent):void { keys[e.keyCode] = false; } );
  28.     messageField = createTextField(SCREEN_WIDTH - 360, SCREEN_HEIGHT - 20360200);
  29.     main.addChild(messageField);
  30.     goToNextStage(); ships[1].exists = false;
  31.     startGameOver(); gameOverTicks = 1;
  32.     main.addEventListener(Event.ENTER_FRAME, update);
  33. }
  34. // Update the game frame.
  35. function update(event:Event):void {
  36.     g.clear(); g.lineStyle(500.8);
  37.     var isStageOver:Boolean = true;
  38.     for each (var s:Ship in ships) {
  39.         s.update();
  40.         if (!s.isPlayer && s.exists) isStageOver = false;
  41.     }
  42.     for (var i:int = 0; i < shots.length; i++) if (!shots[i].update()) { shots.splice(i, 1); i--; }
  43.     if (isInGame) {
  44.         if (isStageOver) goToNextStage();
  45.     } else {
  46.         if (gameOverTicks > 0) {
  47.             gameOverTicks--; messageField.y = SCREEN_HEIGHT - 20 + gameOverTicks;
  48.         } else if (isFirePressed()) {
  49.             isInGame = true; resetStage();
  50.         }
  51.     }
  52. }
  53. var firePressedFlag:Boolean;
  54. function isFirePressed():Boolean {
  55.     if (keys[0x5a] || keys[0xbf] || keys[0x58] || keys[0xbe]) {
  56.         if (!firePressedFlag) {
  57.             firePressedFlag = true;
  58.             return true;
  59.         }
  60.     } else {
  61.         firePressedFlag = false;
  62.     }
  63.     return false;
  64. }
  65. // Ships.
  66. var ships:Vector.<Ship> = new Vector.<Ship>;
  67. class Ship {
  68.     public var pos:Vector3D;
  69.     public var isPlayer:Boolean;
  70.     public var posRecord:Vector.<Vector3D>;
  71.     public var fireRecord:Vector.<Boolean>;
  72.     public var recordIndex:int = 0;
  73.     public var exists:Boolean = true;
  74.     public var speed:Number = 5, shotSpeed:Number = 10;
  75.     public var fireWay:int = 1, fireWayAngle:Number = PI / 5;
  76.     public function update():void {
  77.         if (!exists) return;
  78.         if (isPlayer) { updatePlayer(); return; }
  79.         pos = posRecord[recordIndex];
  80.         if (fireRecord[recordIndex]) addShot(pos, shotSpeed, fireWay, fireWayAngle, false);
  81.         recordIndex++; if (recordIndex >= fireRecord.length) recordIndex = 0;
  82.         g.moveTo(pos.x, pos.y + 10);
  83.         g.lineTo(pos.x - 7, pos.y - 4);
  84.         g.lineTo(pos.x + 7, pos.y - 4);
  85.         g.lineTo(pos.x, pos.y + 10);
  86.         return;
  87.     }
  88.     public function updatePlayer():void {
  89.         var vx:Number = 0, vy:Number = 0;
  90.         if (keys[0x25] || keys[0x41]) vx = -1;
  91.         if (keys[0x26] || keys[0x57]) vy = -1;
  92.         if (keys[0x27] || keys[0x44]) vx =  1;
  93.         if (keys[0x28] || keys[0x53]) vy =  1;
  94.         var isFiring:Boolean = isFirePressed();
  95.         if (isFiring) addShot(pos, shotSpeed, fireWay, fireWayAngle, true);
  96.         if (vx != 0 && vy != 0) { vx *= 0.7; vy *= 0.7; }
  97.         pos.x += vx * speed; pos.y += vy * speed;
  98.         if (pos.x < 10) pos.x = 10;
  99.         else if (pos.x > SCREEN_WIDTH - 10) pos.x = SCREEN_WIDTH - 10;
  100.         if (pos.y < 10) pos.y = 10;
  101.         else if (pos.y > SCREEN_HEIGHT - 10) pos.y = SCREEN_HEIGHT - 10;
  102.         g.moveTo(pos.x, pos.y - 10);
  103.         g.lineTo(pos.x - 7, pos.y + 4);
  104.         g.lineTo(pos.x + 7, pos.y + 4);
  105.         g.lineTo(pos.x, pos.y - 10);
  106.         var p:Vector3D = new Vector3D(pos.x, -(pos.y - SCREEN_HEIGHT * 0.5) + SCREEN_HEIGHT * 0.5);
  107.         posRecord.push(p); fireRecord.push(isFiring);
  108.     }
  109.     public function checkHit(p:Vector3D):Boolean {
  110.         if (!exists) return false;
  111.         var isHit:Boolean = (Vector3D.distance(p, pos) < 15);
  112.         if (isHit) {
  113.             exists = false;
  114.             if (isPlayer) startGameOver();
  115.         }
  116.         return isHit;
  117.     }
  118. }
  119. function goToNextStage():void {
  120.     var s:Ship;
  121.     if (ships.length > 0) {
  122.         ships[ships.length - 1].isPlayer = false;
  123.     } else {
  124.         s = new Ship;
  125.         var p:Vector3D = new Vector3D(SCREEN_WIDTH * 0.5, SCREEN_HEIGHT * 0.25);
  126.         s.posRecord = new Vector.<Vector3D>;
  127.         s.fireRecord = new Vector.<Boolean>;
  128.         s.posRecord.push(p); s.fireRecord.push(false);
  129.         ships.push(s);
  130.     }
  131.     var sn:int = ships.length;
  132.     s = new Ship;
  133.     s.pos = new Vector3D;
  134.     if (sn % 3 == 0) s.shotSpeed += 3;
  135.     if (sn % 5 == 0) s.shotSpeed += 2;
  136.     if (sn % 3 == 2) s.fireWay += 2;
  137.     if (sn % 4 == 0) s.fireWay++;
  138.     if (sn % 5 == 4) s.fireWay++;
  139.     if (sn % 2 == 0) s.fireWayAngle *= 0.7;
  140.     if (sn % 4 == 2) s.fireWayAngle *= 0.8;
  141.     if (sn % 4 == 3) s.speed *= 1.4;
  142.     s.isPlayer = true;
  143.     ships.push(s);
  144.     resetStage();
  145. }
  146. function resetStage():void {
  147.     var sn:int = ships.length - 1;
  148.     var s:Ship;
  149.     for each (s in ships) { s.recordIndex = 0; s.exists = true; }
  150.     shots = null; shots = new Vector.<Shot>;
  151.     s = ships[ships.length - 1];
  152.     s.pos.x = SCREEN_WIDTH * 0.5; s.pos.y = SCREEN_WIDTH * 0.75;
  153.     s.posRecord = null; s.posRecord = new Vector.<Vector3D>;
  154.     s.fireRecord = null; s.fireRecord = new Vector.<Boolean>;
  155.     for (var x:int = 0; x <= SCREEN_WIDTH; x += 15) {
  156.         addShot(new Vector3D(x, 30), 5.0 / (sn + 1), 10false);
  157.     }
  158.     messageField.y = 0;
  159.     messageField.text = "Stage " + sn;
  160. }
  161. // Shots.
  162. var shots:Vector.<Shot>;
  163. class Shot {
  164.     public var pos:Vector3D = new Vector3D, vel:Vector3D = new Vector3D;
  165.     public var isPlayersShot:Boolean;
  166.     public function update():Boolean {
  167.         pos.incrementBy(vel);
  168.         g.moveTo(pos.x, pos.y - 10);
  169.         g.lineTo(pos.x, pos.y + 10);
  170.         if (isPlayersShot) {
  171.             for each (var s:Ship in ships) if (!s.isPlayer) if (s.checkHit(pos)) return false;
  172.         } else {
  173.             ships[ships.length - 1].checkHit(pos);
  174.         }
  175.         return (pos.x >= 0 && pos.x < SCREEN_WIDTH && pos.y >= 0 && pos.y < SCREEN_HEIGHT);
  176.     }
  177. }
  178. function addShot(p:Vector3D, shotSpeed:Number, fireWay:int, fireWayAngle:Number, isPlayer:Boolean):void {
  179.     var s:Shot, a:Number = 0, ai:Number;
  180.     if (fireWay > 1) {
  181.         a = -fireWayAngle;
  182.         ai = fireWayAngle * 2 / (fireWay - 1);
  183.     }
  184.     for (var i:int = 0; i < fireWay; i++) {
  185.         s = new Shot;
  186.         s.pos.x = p.x; s.pos.y = p.y;
  187.         var sa:Number = a;
  188.         if (isPlayer) sa = PI - a;
  189.         s.vel.x = shotSpeed * sin(sa); s.vel.y = shotSpeed * cos(sa);
  190.         s.isPlayersShot = isPlayer;
  191.         shots.push(s);
  192.         a += ai;
  193.     }
  194. }
  195. // Handle the game lifecycle.
  196. var isInGame:Boolean, gameOverTicks:int;
  197. function startGameOver():void {
  198.     isInGame = false; gameOverTicks = 20;
  199.     messageField.text = "GAME OVER";
  200. }
  201. // Utility functions and variables.
  202. var sin:Function = Math.sin, cos:Function = Math.cos, PI:Number = Math.PI;
  203. function createTextField(x:int, y:int, width:int, size:int, color:int):TextField {
  204.     var fm:TextFormat = new TextFormat, fi:TextField = new TextField;
  205.     fm.font = "_typewriter"; fm.bold = true; fm.size = size; fm.color = color; fm.align = TextFormatAlign.RIGHT;
  206.     fi.defaultTextFormat = fm; fi.x = x; fi.y = y; fi.width = width; fi.selectable = false;
  207.     return fi;
  208. }
noswf
  1. // forked from ABA's DefeatMe
  2. // DefeatMe.as
  3. //  Defeat black ships.
  4. //  (To restart from stage 1, reload the page.)
  5. //  <Operation>
  6. //   Movement     : Arrow or [WASD] keys.
  7. //   Fire / Start : [Z], [X], [.] or [/] key.
  8. package {
  9.     import flash.display.Sprite;
  10.     [SWF(width="465", height="465", backgroundColor="0xdddddd", frameRate="30")]
  11.     public class DefeatMe extends Sprite {
  12.         public function DefeatMe() { main = this; initialize(); }
  13.     }
  14. }
  15. import flash.display.*;
  16. import flash.geom.*;
  17. import flash.text.*;
  18. import flash.events.*;
  19. const SCREEN_WIDTH:int = 465, SCREEN_HEIGHT:int = 465;
  20. var main:Sprite, g:Graphics;
  21. var messageField:TextField = new TextField;
  22. var keys:Vector.<Boolean> = new Vector.<Boolean>(256);
  23. // Initialize UIs.
  24. function initialize():void {
  25.     g = main.graphics;
  26.     main.stage.addEventListener(KeyboardEvent.KEY_DOWN, function(e:KeyboardEvent):void { keys[e.keyCode] = true; } );
  27.     main.stage.addEventListener(KeyboardEvent.KEY_UP,   function(e:KeyboardEvent):void { keys[e.keyCode] = false; } );
  28.     messageField = createTextField(SCREEN_WIDTH - 360, SCREEN_HEIGHT - 20360200);
  29.     main.addChild(messageField);
  30.     goToNextStage(); ships[1].exists = false;
  31.     startGameOver(); gameOverTicks = 1;
  32.     main.addEventListener(Event.ENTER_FRAME, update);
  33. }
  34. // Update the game frame.
  35. function update(event:Event):void {
  36.     g.clear(); g.lineStyle(500.8);
  37.     var isStageOver:Boolean = true;
  38.     for each (var s:Ship in ships) {
  39.         s.update();
  40.         if (!s.isPlayer && s.exists) isStageOver = false;
  41.     }
  42.     for (var i:int = 0; i < shots.length; i++) if (!shots[i].update()) { shots.splice(i, 1); i--; }
  43.     if (isInGame) {
  44.         if (isStageOver) goToNextStage();
  45.     } else {
  46.         if (gameOverTicks > 0) {
  47.             gameOverTicks--; messageField.y = SCREEN_HEIGHT - 20 + gameOverTicks;
  48.         } else if (isFirePressed()) {
  49.             isInGame = true; resetStage();
  50.         }
  51.     }
  52. }
  53. var firePressedFlag:Boolean;
  54. function isFirePressed():Boolean {
  55.     if (keys[0x5a] || keys[0xbf] || keys[0x58] || keys[0xbe]) {
  56.         if (!firePressedFlag) {
  57.             firePressedFlag = true;
  58.             return true;
  59.         }
  60.     } else {
  61.         firePressedFlag = false;
  62.     }
  63.     return false;
  64. }
  65. // Ships.
  66. var ships:Vector.<Ship> = new Vector.<Ship>;
  67. class Ship {
  68.     public var pos:Vector3D;
  69.     public var isPlayer:Boolean;
  70.     public var posRecord:Vector.<Vector3D>;
  71.     public var fireRecord:Vector.<Boolean>;
  72.     public var recordIndex:int = 0;
  73.     public var exists:Boolean = true;
  74.     public var speed:Number = 5, shotSpeed:Number = 10;
  75.     public var fireWay:int = 1, fireWayAngle:Number = PI / 5;
  76.     public function update():void {
  77.         if (!exists) return;
  78.         if (isPlayer) { updatePlayer(); return; }
  79.         pos = posRecord[recordIndex];
  80.         if (fireRecord[recordIndex]) addShot(pos, shotSpeed, fireWay, fireWayAngle, false);
  81.         recordIndex++; if (recordIndex >= fireRecord.length) recordIndex = 0;
  82.         g.moveTo(pos.x, pos.y + 10);
  83.         g.lineTo(pos.x - 7, pos.y - 4);
  84.         g.lineTo(pos.x + 7, pos.y - 4);
  85.         g.lineTo(pos.x, pos.y + 10);
  86.         return;
  87.     }
  88.     public function updatePlayer():void {
  89.         var vx:Number = 0, vy:Number = 0;
  90.         if (keys[0x25] || keys[0x41]) vx = -1;
  91.         if (keys[0x26] || keys[0x57]) vy = -1;
  92.         if (keys[0x27] || keys[0x44]) vx =  1;
  93.         if (keys[0x28] || keys[0x53]) vy =  1;
  94.         var isFiring:Boolean = isFirePressed();
  95.         if (isFiring) addShot(pos, shotSpeed, fireWay, fireWayAngle, true);
  96.         if (vx != 0 && vy != 0) { vx *= 0.7; vy *= 0.7; }
  97.         pos.x += vx * speed; pos.y += vy * speed;
  98.         if (pos.x < 10) pos.x = 10;
  99.         else if (pos.x > SCREEN_WIDTH - 10) pos.x = SCREEN_WIDTH - 10;
  100.         if (pos.y < 10) pos.y = 10;
  101.         else if (pos.y > SCREEN_HEIGHT - 10) pos.y = SCREEN_HEIGHT - 10;
  102.         g.moveTo(pos.x, pos.y - 10);
  103.         g.lineTo(pos.x - 7, pos.y + 4);
  104.         g.lineTo(pos.x + 7, pos.y + 4);
  105.         g.lineTo(pos.x, pos.y - 10);
  106.         var p:Vector3D = new Vector3D(pos.x, -(pos.y - SCREEN_HEIGHT * 0.5) + SCREEN_HEIGHT * 0.5);
  107.         posRecord.push(p); fireRecord.push(isFiring);
  108.     }
  109.     public function checkHit(p:Vector3D):Boolean {
  110.         if (!exists) return false;
  111.         var isHit:Boolean = (Vector3D.distance(p, pos) < 15);
  112.         if (isHit) {
  113.             exists = false;
  114.             if (isPlayer) startGameOver();
  115.         }
  116.         return isHit;
  117.     }
  118. }
  119. function goToNextStage():void {
  120.     var s:Ship;
  121.     if (ships.length > 0) {
  122.         ships[ships.length - 1].isPlayer = false;
  123.     } else {
  124.         s = new Ship;
  125.         var p:Vector3D = new Vector3D(SCREEN_WIDTH * 0.5, SCREEN_HEIGHT * 0.25);
  126.         s.posRecord = new Vector.<Vector3D>;
  127.         s.fireRecord = new Vector.<Boolean>;
  128.         s.posRecord.push(p); s.fireRecord.push(false);
  129.         ships.push(s);
  130.     }
  131.     var sn:int = ships.length;
  132.     s = new Ship;
  133.     s.pos = new Vector3D;
  134.     if (sn % 3 == 0) s.shotSpeed += 3;
  135.     if (sn % 5 == 0) s.shotSpeed += 2;
  136.     if (sn % 3 == 2) s.fireWay += 2;
  137.     if (sn % 4 == 0) s.fireWay++;
  138.     if (sn % 5 == 4) s.fireWay++;
  139.     if (sn % 2 == 0) s.fireWayAngle *= 0.7;
  140.     if (sn % 4 == 2) s.fireWayAngle *= 0.8;
  141.     if (sn % 4 == 3) s.speed *= 1.4;
  142.     s.isPlayer = true;
  143.     ships.push(s);
  144.     resetStage();
  145. }
  146. function resetStage():void {
  147.     var sn:int = ships.length - 1;
  148.     var s:Ship;
  149.     for each (s in ships) { s.recordIndex = 0; s.exists = true; }
  150.     shots = null; shots = new Vector.<Shot>;
  151.     s = ships[ships.length - 1];
  152.     s.pos.x = SCREEN_WIDTH * 0.5; s.pos.y = SCREEN_WIDTH * 0.75;
  153.     s.posRecord = null; s.posRecord = new Vector.<Vector3D>;
  154.     s.fireRecord = null; s.fireRecord = new Vector.<Boolean>;
  155.     for (var x:int = 0; x <= SCREEN_WIDTH; x += 15) {
  156.         addShot(new Vector3D(x, 30), 5.0 / (sn + 1), 10false);
  157.     }
  158.     messageField.y = 0;
  159.     messageField.text = "Stage " + sn;
  160. }
  161. // Shots.
  162. var shots:Vector.<Shot>;
  163. class Shot {
  164.     public var pos:Vector3D = new Vector3D, vel:Vector3D = new Vector3D;
  165.     public var isPlayersShot:Boolean;
  166.     public function update():Boolean {
  167.         pos.incrementBy(vel);
  168.         g.moveTo(pos.x, pos.y - 10);
  169.         g.lineTo(pos.x, pos.y + 10);
  170.         if (isPlayersShot) {
  171.             for each (var s:Ship in ships) if (!s.isPlayer) if (s.checkHit(pos)) return false;
  172.         } else {
  173.             ships[ships.length - 1].checkHit(pos);
  174.         }
  175.         return (pos.x >= 0 && pos.x < SCREEN_WIDTH && pos.y >= 0 && pos.y < SCREEN_HEIGHT);
  176.     }
  177. }
  178. function addShot(p:Vector3D, shotSpeed:Number, fireWay:int, fireWayAngle:Number, isPlayer:Boolean):void {
  179.     var s:Shot, a:Number = 0, ai:Number;
  180.     if (fireWay > 1) {
  181.         a = -fireWayAngle;
  182.         ai = fireWayAngle * 2 / (fireWay - 1);
  183.     }
  184.     for (var i:int = 0; i < fireWay; i++) {
  185.         s = new Shot;
  186.         s.pos.x = p.x; s.pos.y = p.y;
  187.         var sa:Number = a;
  188.         if (isPlayer) sa = PI - a;
  189.         s.vel.x = shotSpeed * sin(sa); s.vel.y = shotSpeed * cos(sa);
  190.         s.isPlayersShot = isPlayer;
  191.         shots.push(s);
  192.         a += ai;
  193.     }
  194. }
  195. // Handle the game lifecycle.
  196. var isInGame:Boolean, gameOverTicks:int;
  197. function startGameOver():void {
  198.     isInGame = false; gameOverTicks = 20;
  199.     messageField.text = "GAME OVER";
  200. }
  201. // Utility functions and variables.
  202. var sin:Function = Math.sin, cos:Function = Math.cos, PI:Number = Math.PI;
  203. function createTextField(x:int, y:int, width:int, size:int, color:int):TextField {
  204.     var fm:TextFormat = new TextFormat, fi:TextField = new TextField;
  205.     fm.font = "_typewriter"; fm.bold = true; fm.size = size; fm.color = color; fm.align = TextFormatAlign.RIGHT;
  206.     fi.defaultTextFormat = fm; fi.x = x; fi.y = y; fi.width = width; fi.selectable = false;
  207.     return fi;
  208. }
noswf
  1. // forked from ABA's DefeatMe
  2. // DefeatMe.as
  3. //  Defeat black ships.
  4. //  (To restart from stage 1, reload the page.)
  5. //  <Operation>
  6. //   Movement     : Arrow or [WASD] keys.
  7. //   Fire / Start : [Z], [X], [.] or [/] key.
  8. package {
  9.     import flash.display.Sprite;
  10.     [SWF(width="465", height="465", backgroundColor="0xdddddd", frameRate="30")]
  11.     public class DefeatMe extends Sprite {
  12.         public function DefeatMe() { main = this; initialize(); }
  13.     }
  14. }
  15. import flash.display.*;
  16. import flash.geom.*;
  17. import flash.text.*;
  18. import flash.events.*;
  19. const SCREEN_WIDTH:int = 465, SCREEN_HEIGHT:int = 465;
  20. var main:Sprite, g:Graphics;
  21. var messageField:TextField = new TextField;
  22. var keys:Vector.<Boolean> = new Vector.<Boolean>(256);
  23. // Initialize UIs.
  24. function initialize():void {
  25.     g = main.graphics;
  26.     main.stage.addEventListener(KeyboardEvent.KEY_DOWN, function(e:KeyboardEvent):void { keys[e.keyCode] = true; } );
  27.     main.stage.addEventListener(KeyboardEvent.KEY_UP,   function(e:KeyboardEvent):void { keys[e.keyCode] = false; } );
  28.     messageField = createTextField(SCREEN_WIDTH - 360, SCREEN_HEIGHT - 20360200);
  29.     main.addChild(messageField);
  30.     goToNextStage(); ships[1].exists = false;
  31.     startGameOver(); gameOverTicks = 1;
  32.     main.addEventListener(Event.ENTER_FRAME, update);
  33. }
  34. // Update the game frame.
  35. function update(event:Event):void {
  36.     g.clear(); g.lineStyle(500.8);
  37.     var isStageOver:Boolean = true;
  38.     for each (var s:Ship in ships) {
  39.         s.update();
  40.         if (!s.isPlayer && s.exists) isStageOver = false;
  41.     }
  42.     for (var i:int = 0; i < shots.length; i++) if (!shots[i].update()) { shots.splice(i, 1); i--; }
  43.     if (isInGame) {
  44.         if (isStageOver) goToNextStage();
  45.     } else {
  46.         if (gameOverTicks > 0) {
  47.             gameOverTicks--; messageField.y = SCREEN_HEIGHT - 20 + gameOverTicks;
  48.         } else if (isFirePressed()) {
  49.             isInGame = true; resetStage();
  50.         }
  51.     }
  52. }
  53. var firePressedFlag:Boolean;
  54. function isFirePressed():Boolean {
  55.     if (keys[0x5a] || keys[0xbf] || keys[0x58] || keys[0xbe]) {
  56.         if (!firePressedFlag) {
  57.             firePressedFlag = true;
  58.             return true;
  59.         }
  60.     } else {
  61.         firePressedFlag = false;
  62.     }
  63.     return false;
  64. }
  65. // Ships.
  66. var ships:Vector.<Ship> = new Vector.<Ship>;
  67. class Ship {
  68.     public var pos:Vector3D;
  69.     public var isPlayer:Boolean;
  70.     public var posRecord:Vector.<Vector3D>;
  71.     public var fireRecord:Vector.<Boolean>;
  72.     public var recordIndex:int = 0;
  73.     public var exists:Boolean = true;
  74.     public var speed:Number = 5, shotSpeed:Number = 10;
  75.     public var fireWay:int = 1, fireWayAngle:Number = PI / 5;
  76.     public function update():void {
  77.         if (!exists) return;
  78.         if (isPlayer) { updatePlayer(); return; }
  79.         pos = posRecord[recordIndex];
  80.         if (fireRecord[recordIndex]) addShot(pos, shotSpeed, fireWay, fireWayAngle, false);
  81.         recordIndex++; if (recordIndex >= fireRecord.length) recordIndex = 0;
  82.         g.moveTo(pos.x, pos.y + 10);
  83.         g.lineTo(pos.x - 7, pos.y - 4);
  84.         g.lineTo(pos.x + 7, pos.y - 4);
  85.         g.lineTo(pos.x, pos.y + 10);
  86.         return;
  87.     }
  88.     public function updatePlayer():void {
  89.         var vx:Number = 0, vy:Number = 0;
  90.         if (keys[0x25] || keys[0x41]) vx = -1;
  91.         if (keys[0x26] || keys[0x57]) vy = -1;
  92.         if (keys[0x27] || keys[0x44]) vx =  1;
  93.         if (keys[0x28] || keys[0x53]) vy =  1;
  94.         var isFiring:Boolean = isFirePressed();
  95.         if (isFiring) addShot(pos, shotSpeed, fireWay, fireWayAngle, true);
  96.         if (vx != 0 && vy != 0) { vx *= 0.7; vy *= 0.7; }
  97.         pos.x += vx * speed; pos.y += vy * speed;
  98.         if (pos.x < 10) pos.x = 10;
  99.         else if (pos.x > SCREEN_WIDTH - 10) pos.x = SCREEN_WIDTH - 10;
  100.         if (pos.y < 10) pos.y = 10;
  101.         else if (pos.y > SCREEN_HEIGHT - 10) pos.y = SCREEN_HEIGHT - 10;
  102.         g.moveTo(pos.x, pos.y - 10);
  103.         g.lineTo(pos.x - 7, pos.y + 4);
  104.         g.lineTo(pos.x + 7, pos.y + 4);
  105.         g.lineTo(pos.x, pos.y - 10);
  106.         var p:Vector3D = new Vector3D(pos.x, -(pos.y - SCREEN_HEIGHT * 0.5) + SCREEN_HEIGHT * 0.5);
  107.         posRecord.push(p); fireRecord.push(isFiring);
  108.     }
  109.     public function checkHit(p:Vector3D):Boolean {
  110.         if (!exists) return false;
  111.         var isHit:Boolean = (Vector3D.distance(p, pos) < 15);
  112.         if (isHit) {
  113.             exists = false;
  114.             if (isPlayer) startGameOver();
  115.         }
  116.         return isHit;
  117.     }
  118. }
  119. function goToNextStage():void {
  120.     var s:Ship;
  121.     if (ships.length > 0) {
  122.         ships[ships.length - 1].isPlayer = false;
  123.     } else {
  124.         s = new Ship;
  125.         var p:Vector3D = new Vector3D(SCREEN_WIDTH * 0.5, SCREEN_HEIGHT * 0.25);
  126.         s.posRecord = new Vector.<Vector3D>;
  127.         s.fireRecord = new Vector.<Boolean>;
  128.         s.posRecord.push(p); s.fireRecord.push(false);
  129.         ships.push(s);
  130.     }
  131.     var sn:int = ships.length;
  132.     s = new Ship;
  133.     s.pos = new Vector3D;
  134.     if (sn % 3 == 0) s.shotSpeed += 3;
  135.     if (sn % 5 == 0) s.shotSpeed += 2;
  136.     if (sn % 3 == 2) s.fireWay += 2;
  137.     if (sn % 4 == 0) s.fireWay++;
  138.     if (sn % 5 == 4) s.fireWay++;
  139.     if (sn % 2 == 0) s.fireWayAngle *= 0.7;
  140.     if (sn % 4 == 2) s.fireWayAngle *= 0.8;
  141.     if (sn % 4 == 3) s.speed *= 1.4;
  142.     s.isPlayer = true;
  143.     ships.push(s);
  144.     resetStage();
  145. }
  146. function resetStage():void {
  147.     var sn:int = ships.length - 1;
  148.     var s:Ship;
  149.     for each (s in ships) { s.recordIndex = 0; s.exists = true; }
  150.     shots = null; shots = new Vector.<Shot>;
  151.     s = ships[ships.length - 1];
  152.     s.pos.x = SCREEN_WIDTH * 0.5; s.pos.y = SCREEN_WIDTH * 0.75;
  153.     s.posRecord = null; s.posRecord = new Vector.<Vector3D>;
  154.     s.fireRecord = null; s.fireRecord = new Vector.<Boolean>;
  155.     for (var x:int = 0; x <= SCREEN_WIDTH; x += 15) {
  156.         addShot(new Vector3D(x, 30), 5.0 / (sn + 1), 10false);
  157.     }
  158.     messageField.y = 0;
  159.     messageField.text = "Stage " + sn;
  160. }
  161. // Shots.
  162. var shots:Vector.<Shot>;
  163. class Shot {
  164.     public var pos:Vector3D = new Vector3D, vel:Vector3D = new Vector3D;
  165.     public var isPlayersShot:Boolean;
  166.     public function update():Boolean {
  167.         pos.incrementBy(vel);
  168.         g.moveTo(pos.x, pos.y - 10);
  169.         g.lineTo(pos.x, pos.y + 10);
  170.         if (isPlayersShot) {
  171.             for each (var s:Ship in ships) if (!s.isPlayer) if (s.checkHit(pos)) return false;
  172.         } else {
  173.             ships[ships.length - 1].checkHit(pos);
  174.         }
  175.         return (pos.x >= 0 && pos.x < SCREEN_WIDTH && pos.y >= 0 && pos.y < SCREEN_HEIGHT);
  176.     }
  177. }
  178. function addShot(p:Vector3D, shotSpeed:Number, fireWay:int, fireWayAngle:Number, isPlayer:Boolean):void {
  179.     var s:Shot, a:Number = 0, ai:Number;
  180.     if (fireWay > 1) {
  181.         a = fireWayAngle * 1 / (fireWay);
  182.         ai = fireWayAngle * 1 / (fireWay);
  183.     }
  184.     for (var i:int = 0; i < fireWay; i++) {
  185.         s = new Shot;
  186.         s.pos.x = p.x; s.pos.y = p.y;
  187.         var sa:Number = a;
  188.         if (isPlayer) sa = PI - a;
  189.         s.vel.x = shotSpeed * sin(sa); s.vel.y = shotSpeed * cos(sa);
  190.         s.isPlayersShot = isPlayer;
  191.         shots.push(s);
  192.         a += ai;
  193.     }
  194. }
  195. // Handle the game lifecycle.
  196. var isInGame:Boolean, gameOverTicks:int;
  197. function startGameOver():void {
  198.     isInGame = false; gameOverTicks = 20;
  199.     messageField.text = "GAME OVER";
  200. }
  201. // Utility functions and variables.
  202. var sin:Function = Math.sin, cos:Function = Math.cos, PI:Number = Math.PI;
  203. function createTextField(x:int, y:int, width:int, size:int, color:int):TextField {
  204.     var fm:TextFormat = new TextFormat, fi:TextField = new TextField;
  205.     fm.font = "_typewriter"; fm.bold = true; fm.size = size; fm.color = color; fm.align = TextFormatAlign.RIGHT;
  206.     fi.defaultTextFormat = fm; fi.x = x; fi.y = y; fi.width = width; fi.selectable = false;
  207.     return fi;
  208. }
noswf
Get Adobe Flash Player