• 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;
    }

     

  • 相关阅读:
    C#解析json的几种方式
    记一次linux服务部署
    记一次AngularJs 路由 $stateChangeStart不起作用(细节决定成败)
    Could not commit JPA transaction RollbackException: Transaction marked as rollbackOnly
    elasticsearch服务安装采坑
    spring boot ${}占位符不起作用
    js 事件冒泡、捕获;call()、apply()
    angular $digest already in progress
    idea其他人把jar更新之后更新不到
    spring接入swagger后单元测试报错
  • 原文地址:https://www.cnblogs.com/klh5211314/p/2685825.html
Copyright © 2020-2023  润新知