zoukankan      html  css  js  c++  java
  • 小程序的编写—2

                                                                      猜数字游戏

    package {

                           import flash.display.MovieClip;

                           import flash.events.*;

                           import flash.text.*;

                    public class Main1 extends MovieClip

                            {

                               private var ar:Array;

                               public var sc_txt:TextField;

                               private var number:int;

                               public var ts_txt:TextField;

                               public var sr_txt:TextField;

                     public function Main1():void

                               {   

                                    qd_btn.visible = false;

                                    kaishi_btn.addEventListener(MouseEvent.CLICK,onks);

                                    qd_btn.addEventListener(MouseEvent.CLICK, onqueding);

                                }  

                     private function onks(e:MouseEvent):void   

                               {    

                                     number = int(Math.random() * 100);

                                     ts_txt.text = "";  

                                     sr_txt.visible = true;  

                                     qd_btn.visible = true;  

                                      sr_txt.text = "";  

                                      sc_txt.text = "";

                               }

                     private function onqueding(e:MouseEvent):void

                              {   

                                     var b:int = int(sr_txt.text);

                                     if (b < 0 || b > 99)  

                                              {   

                                                    sc_txt.text = "输入的数字范围有错!";

                                              }

                                     else if (b < number)  

                                             {  

                                                       sc_txt.text = "输入的数字太小了!";  

                                                       ts_txt.appendText(String(b) + "->");

                                               }    

                                     else if (b > number)    

                                               {    

                                                         sc_txt.text = "输入的数字太大了!";

                                                         ts_txt.appendText(String(b) + "->");

                                                }  

                                     else if (b == number)   

                                               {   

                                                      sc_txt.text = "恭喜你,你猜对了!!!";  

                                                      ts_txt.appendText("正确");  

                                                      sr_txt.visible = false;   

                                                      qd_btn.visible = false;

                                                }   

                                                        sr_txt.text = "";

                                   }

                       }

               }

    我就是我,颜色不一样的烟火。 ----辉。
  • 相关阅读:
    我为什么写博客
    Jquery选中行实现行中的Checkbox的选中与取消选中
    jquery中attr和prop的区别
    如何将.il、.res文件封装成dll文件
    修改VS2010生成的dll文件中的内容
    asp.net mvc4中自定义404页面
    asp.net EF6.0中出现未找到具有固定名称“System.Data.SqlClient”的 ADO.NET提供程序的实体框架提供程序解决办法
    ASP.NET中JSON的序列化和反序列化(转)
     WPF 控件总结
    C语言基础:二维数组 分类: iOS学习 c语言基础 2015-06-10 21:42 16人阅读 评论(0) 收藏
  • 原文地址:https://www.cnblogs.com/klh5211314/p/2703096.html
Copyright © 2011-2022 走看看