flash on 2012-4-18

by yurij.shaulov
♥0 | Line 45 | Modified 2012-04-18 03:25:25 | MIT License
play

ActionScript3 source code

/**
 * Copyright yurij.shaulov ( http://wonderfl.net/user/yurij.shaulov )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/opDE
 */

package {
    import flash.ui.Mouse;
    import flash.events.Event;
    import flash.events.MouseEvent;

  import flash.display.Sprite;
  import flash.text.TextField;
      import flash.text.TextFieldType;
  
  public class Main extends Sprite {
    public function Main(  ) {
      var field:TextField = new TextField(  );
      var trac:TextField = new TextField(  );
     var button:Sprite = new Sprite();
        button.graphics.lineStyle(1, 0xBBBBBB);
        button.graphics.beginFill(0xEEEEEE);
        button.graphics.drawRoundRect(0, 0, 100, 20, 5, 5);
        button.graphics.endFill();
        
        addChild(button);
        
        button.x = 20;
        button.y = 50;
        button.mouseChildren = false;
        button.buttonMode = true;
        button.addEventListener(MouseEvent.CLICK, clic);
    
      trac.type = TextFieldType.INPUT;
      trac.x=50;
      trac.y=80;
      trac.autoSize = flash.text.TextFieldAutoSize.LEFT;

      trac.text = "ответ";
      trac.border = true;
      
      addChild(trac);  
     field.type = TextFieldType.INPUT;
      field.autoSize = flash.text.TextFieldAutoSize.LEFT;

      field.text = "немыслимый бред";
      field.border = true;
      
      addChild(field);
      function clic(event:MouseEvent){
          trace(field.text.indexOf("hello"));
          if(field.text.indexOf("hello")<0){
              
              trac.appendText("ghbdtn");
          }else{
              trac.appendText("null")
          }
      }
    }
  }
}