Advertisement
Guest User

Untitled

a guest
Jul 1st, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Haxe 1.13 KB | None | 0 0
  1. class ExoLundi2 {
  2.   static function main() {
  3.     var root = flash.Lib.current.stage;
  4.  
  5.     var input    = new flash.text.TextField();
  6.     input.type   = flash.text.TextFieldType.INPUT;
  7.     input.x      = 0;
  8.     input.y      = 0;
  9.     input.width  = root.stageWidth;
  10.     input.height = 20;
  11.     input.border = true;
  12.     input.text   = "Monsieur Jack, vous dactylographiez bien mieux que votre ami Wolf";
  13.  
  14.     var output    = new flash.text.TextField();
  15.     output.x      = 0;
  16.     output.y      = 22;
  17.     output.width  = root.stageWidth;
  18.     output.height = 20;
  19.     output.text   = "Pangramme : oui";
  20.  
  21.     input.addEventListener("change", function(_) {
  22.       var pan = new Map<Int, Bool>();
  23.       for (i in 97 ... 123)
  24.         pan[i] = false;
  25.  
  26.       for (i in 0 ... input.text.length) {
  27.         var chr = input.text.charAt(i).toLowerCase().charCodeAt(0);
  28.  
  29.         if (chr >= 97 && chr <= 122)
  30.           pan[chr] = true;
  31.       }
  32.  
  33.       var test_pan = pan.toString().indexOf("false") == -1;
  34.       output.text = "Pangramme : " + (test_pan ? "oui" : "non");
  35.     });
  36.  
  37.     root.addChild(input);
  38.     root.addChild(output);
  39.   }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement