Letters.swf gemaakt door SMG
  1. //Letters.swf: typ in het enige tekstveld
  2. //Textveld aanmaken
  3. var textVeld:TextField = new TextField;
  4. textVeld.x = 50;
  5. textVeld.y = 50;
  6. textVeld.height = 20;
  7. textVeld.width = 15;
  8. textVeld.type = "input";
  9. textVeld.border = true;
  10. textVeld.borderColor = 0x999999;
  11. addChild(textVeld);
  12. textVeld.addEventListener(KeyboardEvent.KEY_UP, typo);
  13.  
  14. var array:Array=new Array(String);
  15. array[1] = "0";
  16. array[2] = "1";
  17. array[3] = "2";
  18. array[4] = "3";
  19. array[5] = "4";
  20. array[6] = "5";
  21. array[7] = "6";
  22. array[8] = "7";
  23. array[9] = "8";
  24. array[10] = "9";
  25. array[11] = "A";
  26. array[12] = "B";
  27. array[13] = "C";
  28. array[14] = "D";
  29. array[15] = "E";
  30. array[16] = "F";
  31. var kleurcode:String;
  32. var xas:int;
  33. var yas:int;
  34. var grootte:int;
  35.  
  36. var raster:Sprite=new Sprite();
  37. function typo(event:KeyboardEvent) {
  38.         //tekstkleur bepalen
  39.         kleurcode = "0x";
  40.         kleurcode += array[Math.ceil(Math.random()*16)] + array[Math.ceil(Math.random()*16)] + array[Math.ceil(Math.random()*16)] + array[Math.ceil(Math.random()*16)] + array[Math.ceil(Math.random()*16)] + array[Math.ceil(Math.random()*16)];
  41.  
  42.         //x en y bepalen
  43.         xas = Math.ceil(Math.random()*550);
  44.         yas = Math.ceil(Math.random()*400);
  45.  
  46.         //grootte tekst bepalen
  47.         grootte = Math.ceil(Math.random()*50);
  48.  
  49.         var t:TextField = new TextField;
  50.  
  51.         //tekstformat opbouwen
  52.         var myFormat:TextFormat = new TextFormat();
  53.         myFormat.color = kleurcode;
  54.         myFormat.font = "Arial";
  55.         myFormat.size = grootte;
  56.  
  57.         //veld weergeven
  58.         t.text = textVeld.text;
  59.         t.setTextFormat(myFormat);
  60.         t.x = xas;
  61.         t.y = yas;
  62.         addChild(t);
  63.  
  64.         textVeld.text = "";
  65.         var ui:uint = uint(kleurcode);
  66.         if (Math.ceil(Math.random()*5) > 4) {
  67.                 raster.graphics.lineStyle(1, ui, 0.5);
  68.                 raster.graphics.moveTo(Math.ceil(Math.random()*550), Math.ceil(Math.random()*400));
  69.                 raster.graphics.lineTo(Math.ceil(Math.random()*550), Math.ceil(Math.random()*400));
  70.                 addChild(raster);
  71.         }
  72. }
Syntax higlighting by GeSHi