zoukankan      html  css  js  c++  java
  • 2012、09、14 听课笔记

    2012.9.14 

    电路加减速旋转

     

    btn1.addEventListener(MouseEvent.CLICK,onBtn1ClickHandler);

    btn2.addEventListener(MouseEvent.CLICK,onBtn2ClickHandler);

     

    stage.addEventListener(Event.ENTER_FRAME,onMcXuanZhuanHandler);

     

    varbtn1boolean=true;

    varbtn2boolean=true;

    var speed1:int=10;       定义速度

     

     

    functiononMcXuanZhuanHandler(e:Event):void

    {

           if(btn1boolean==true&&btn2boolean==true)

           {

                  mc.rotation +=speed1;

           }

    }

     

    functiononBtn1ClickHandler(e:MouseEvent):void

    {

           if(btn1boolean==true)

           {

                  btn1.gotoAndStop(2)

                  btn1boolean=false

           }else

           {

                  btn1.gotoAndStop(1)

                  btn1boolean=true

           }

          

    }

    functiononBtn2ClickHandler(e:MouseEvent):void

    {

           if(btn2boolean==true)

           {

                  btn2.gotoAndStop(2)

                  btn2boolean=false

           }else

           {

                  btn2.gotoAndStop(1)

                  btn2boolean=true

           }

    }

    an.addEventListener(MouseEvent.CLICK,onAn0ClickHandler);

    functiononAnClickHandler(e:MouseEvent):void

    {

           speed1 -=3;

    }

    an0.addEventListener(MouseEvent.CLICK,onAnClickHandler);

    functiononAn0ClickHandler(e:MouseEvent):void

    {

           speed1 +=3;

    }

     

    递归法1到一百的和:

    trace(add1(0));

     

    functionadd1(ab:int):int

    {

           if(ab> 100)

           {

                  return 0 ;

           }

           else

           {

                  trace(ab);

                  return ab + add1(ab+1);

                 

                  }

          

    }

     

    简单计算机的制作代码

     

    btn_1.addEventListener(MouseEvent.CLICK,onBtn1ClickHandler)
    var qiu:Boolean = false;
    function onBtn1ClickHandler(e:MouseEvent):void
    {
     if (qiu == false)
     {
      tet.text = "";
      tet.appendText("1");
      qiu = true;
     }
     else
     {
      tet.appendText("1");
     }
    }
    btn_2.addEventListener(MouseEvent.CLICK,onBtn2ClickHandler)
    function onBtn2ClickHandler(e:MouseEvent):void
    {
     if (qiu == false)
     {
      tet.text = "";
      tet.appendText("2");
      qiu = true;
     }
     else
     {
      tet.appendText("2");
     }
    }
    btn_3.addEventListener(MouseEvent.CLICK,onBtn3ClickHandler)
    function onBtn3ClickHandler(e:MouseEvent):void
    {
     if (qiu == false)
     {
      tet.text = "";
      tet.appendText("3");
      qiu = true;
     }
     else
     {
      tet.appendText("3");
     }
    }
    btn_4.addEventListener(MouseEvent.CLICK,onBtn4ClickHandler)
    function onBtn4ClickHandler(e:MouseEvent):void
    {
     if (qiu == false)
     {
      tet.text = "";
      tet.appendText("4");
      qiu = true;
     }
     else
     {
      tet.appendText("4");
     }
    }
    btn_5.addEventListener(MouseEvent.CLICK,onBtn5ClickHandler)
    function onBtn5ClickHandler(e:MouseEvent):void
    {
     if (qiu == false)
     {
      tet.text = "";
      tet.appendText("5");
      qiu = true;
     }
     else
     {
      tet.appendText("5");
     }
    }
    btn_6.addEventListener(MouseEvent.CLICK,onBtn6ClickHandler)
    function onBtn6ClickHandler(e:MouseEvent):void
    {
     if (qiu == false)
     {
      tet.text = "";
      tet.appendText("6");
      qiu = true;
     }
     else
     {
      tet.appendText("6");
     }
    }
    btn_7.addEventListener(MouseEvent.CLICK,onBtn7ClickHandler)
    function onBtn7ClickHandler(e:MouseEvent):void
    {
     if (qiu == false)
     {
      tet.text = "";
      tet.appendText("7");
      qiu = true;
     }
     else
     {
      tet.appendText("7");
     }
    }
    btn_8.addEventListener(MouseEvent.CLICK,onBtn8ClickHandler)
    function onBtn8ClickHandler(e:MouseEvent):void
    {
     if (qiu == false)
     {
      tet.text = "";
      tet.appendText("8");
      qiu = true;
     }
     else
     {
      tet.appendText("8");
     }
    }
    btn_9.addEventListener(MouseEvent.CLICK,onBtn9ClickHandler)
    function onBtn9ClickHandler(e:MouseEvent):void
    {
     if (qiu == false)
     {
      tet.text = "";
      tet.appendText("9");
      qiu = true;
     }
     else
     {
      tet.appendText("9");
     }
    }
    btn_0.addEventListener(MouseEvent.CLICK,onBtn0ClickHandler)
    function onBtn0ClickHandler(e:MouseEvent):void
    {
     if (qiu == false)
     {
      tet.text = "";
      tet.appendText("0");
      qiu = true;
     }
     else
     {
      tet.appendText("0");
     }
    }
    var fh:String;
    var now:String;
    btn_jia.addEventListener(MouseEvent.CLICK,onBtnjiaClickHandler)
    function onBtnjiaClickHandler(e:MouseEvent):void
    {
     now = tet.text;
     fh = "+";
     tet.text = "";
    }
    btn_jian.addEventListener(MouseEvent.CLICK,onBtnjianClickHandler)
    function onBtnjianClickHandler(e:MouseEvent):void
    {
     now = tet.text;
     fh = "-";
     tet.text = "";
    }
    btn_cheng.addEventListener(MouseEvent.CLICK,onBtnchengClickHandler)
    function onBtnchengClickHandler(e:MouseEvent):void
    {
     now = tet.text;
     fh = "*";
     tet.text = "";
    }
    btn_chu.addEventListener(MouseEvent.CLICK,onBtnchuClickHandler)
    function onBtnchuClickHandler(e:MouseEvent):void
    {
     now = tet.text;
     fh = "/";
     tet.text = "";
    }
    btn_qingchu.addEventListener(MouseEvent.CLICK,onBtnqingchuClickHandler)
    function onBtnqingchuClickHandler(e:MouseEvent):void
    {
     tet.text = "";
    }
    btn_dengyu.addEventListener(MouseEvent.CLICK,onBtndengyuClickHandler)
    function onBtndengyuClickHandler(e:MouseEvent):void
    {
     if (fh == "+")
     {
      tet.text = String(Number(now) + Number(tet.text))
     }
     if (fh == "-")
     {
      tet.text = String(Number(now) - Number(tet.text))
     }
     if (fh == "*")
     {
      tet.text = String(Number(now) * Number(tet.text))
     }
     if (fh == "/")
     {
      tet.text = String(Number(now) / Number(tet.text))
     }
       qiu = false;
    }

     

  • 相关阅读:
    android系列7.单元测试学习
    DELPHI DATASNAP 2010 入门操作(2)不写一行代码,绿色三层我也行
    基于Delphi的融合DLL中的窗口
    Delphi环境中编写调用DLL的方法和技巧 【转】
    利用Cookies实现ASP.NET跨域单点登录
    为项目安装添加WEB调用本地应用程序功能
    利用C#动态编译功能实现像Javascript中的Eval的功能来将一段字符串进行数学运算
    多音节单词的重读音节的位置飘雪搜狐博客
    NDK开发详细讲解转载自c101zxg的博客_赤松子耶_新浪博客
    Computer Vision and Image Processing Journal
  • 原文地址:https://www.cnblogs.com/klh5211314/p/2685825.html
Copyright © 2011-2022 走看看