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

                                                                           赛马

    package 

    {  

                import flash.display.MovieClip;

                import flash.events.Event;

                import flash.events.MouseEvent; 

                import flash.media.Sound;

                import flash.media.SoundChannel;

                import flash.display.Loader;

                import flash.net.URLRequest;

       public class Main_1 extends MovieClip

         {  

                           var sound:Sound=new Sound();     

                           var soundChannel:SoundChannel=new SoundChannel();   

                           var pausePosition:int = soundChannel.position;  

                    public function Main_1()   

                           {

                                    sound.load(new URLRequest("1102.mp3"));  

                                    soundChannel = sound.play(pausePosition);

                                    fun();

                                   play_btn.addEventListener(MouseEvent.CLICK,onPlayHandler);   

                                   replay_btn.addEventListener(MouseEvent.CLICK,onReplayHandler);  

                                   ma_1.gotoAndStop(1);   

                                   ma_2.gotoAndStop(1);  

                                   ma_3.gotoAndStop(1);  

                                   ma_4.gotoAndStop(1);  

                                   ma_5.gotoAndStop(1);   

                                   ma_1.x = 10;    

                                  ma_2.x = 10;    

                                  ma_3.x = 10;    

                                  ma_4.x = 10;     

                                  ma_5.x = 10;

                           }

                    public function fun():void

                         {          

                                      ma_1.stop();  

                                      ma_2.stop();

                                      ma_3.stop();

                                      ma_4.stop();

                                      ma_5.stop();   

                                      ma_1.x = 10;

                                      ma_2.x = 10;  

                                      ma_3.x = 10;  

                                      ma_4.x = 10;

                                      ma_5.x = 10;    

                                      txt.text = "";

                       }  

                 public function onPlayHandler(e:MouseEvent):void

                     {  

                                      ma_1.addEventListener(Event.ENTER_FRAME,onGo_1);   

                                      ma_2.addEventListener(Event.ENTER_FRAME,onGo_2);  

                                      ma_3.addEventListener(Event.ENTER_FRAME,onGo_3);  

                                      ma_4.addEventListener(Event.ENTER_FRAME,onGo_4);

                                      ma_5.addEventListener(Event.ENTER_FRAME,onGo_5);  

                     }  

                 public function onGo_1(e:Event):void

                    {

                               if (ma_1.x >= 520)   

                                           {    

                                                txt.appendText("1号>");   

                                                ma_1.removeEventListener(Event.ENTER_FRAME,onGo_1);  

                                                ma_1.gotoAndStop(1);

                                            }

                               else

                                          {    

                                               ma_1.play();  

                                               ma_1.x += Math.random() * 10;  

                                           }  

                     }

                     public function onGo_2(e:Event):void  

                       {

                                 if (ma_2.x >= 520)   

                                     {   

                                             txt.appendText("2号>");  

                                             ma_2.removeEventListener(Event.ENTER_FRAME,onGo_2);   

                                             ma_2.gotoAndStop(1);

                                      }  

                                 else  

                                     {  

                                            ma_2.play();   

                                            ma_2.x += Math.random() * 10;

                                      }

                        }

                        public function onGo_3(e:Event):void

                                  {  

                                         if (ma_3.x >= 520)  

                                             {  

                                                 txt.appendText("3号>");   

                                                 ma_3.removeEventListener(Event.ENTER_FRAME,onGo_3);  

                                                 ma_3.gotoAndStop(1);

                                              }

                                       else

                                             {   

                                                  ma_3.play();   

                                                  ma_3.x += Math.random() * 10;

                                             }  

                                }  

                      public function onGo_4(e:Event):void   

                         {  

                               if (ma_4.x >= 520)

                                 {   

                                        txt.appendText("4号>");   

                                        ma_4.removeEventListener(Event.ENTER_FRAME,onGo_4);  

                                        ma_4.gotoAndStop(1);   

                                  }   

                            else  

                                  {    

                                       ma_4.play();  

                                       ma_4.x += Math.random() * 10;   

                                   }  

                      }

                     public function onGo_5(e:Event):void

                          {   

                                if (ma_5.x >= 520)  

                                   {    

                                         txt.appendText("5号>");  

                                         ma_5.removeEventListener(Event.ENTER_FRAME,onGo_5);

                                         ma_5.gotoAndStop(1);   

                                   }   

                              else

                                     {   

                                          ma_5.play();  

                                          ma_5.x += Math.random() * 10;   

                                      }  

                         }  

                public function onReplayHandler(e:Event):void   

                               {    

                                                ma_1.x = 10;

                                                ma_2.x = 10;

                                                ma_3.x = 10;  

                                                ma_4.x = 10;  

                                                ma_5.x = 10;

                                                ma_1.stop();

                                                ma_2.stop();

                                                ma_3.stop();  

                                                ma_4.stop();

                                                ma_5.stop();

                                                ma_1.removeEventListener(Event.ENTER_FRAME,onGo_1);

                                                ma_2.removeEventListener(Event.ENTER_FRAME,onGo_2);

                                                ma_3.removeEventListener(Event.ENTER_FRAME,onGo_3);

                                                ma_4.removeEventListener(Event.ENTER_FRAME,onGo_4);

                                                ma_5.removeEventListener(Event.ENTER_FRAME,onGo_5);  

                                                 txt.text = "";    soundChannel.stop();  

                              }  

                  }

    }

    我就是我,颜色不一样的烟火。 ----辉。
  • 相关阅读:
    二路归并排序简介及其并行化 分类: 算法与数据结构 2015-05-08 17:46 112人阅读 评论(0) 收藏
    基数排序简介及其并行化 分类: 算法与数据结构 2015-05-08 10:10 59人阅读 评论(0) 收藏
    常见排序算法分类 分类: 算法与数据结构 2015-05-08 00:49 31人阅读 评论(0) 收藏
    浅谈new operator、operator new和placement new 分类: C/C++ 2015-05-05 00:19 41人阅读 评论(0) 收藏
    OpenMP对于嵌套循环应该添加多少个parallel for 分类: OpenMP C/C++ Linux 2015-04-27 14:48 53人阅读 评论(0) 收藏
    C++实现不能被继承的类——终结类 分类: C/C++ 2015-04-06 14:48 64人阅读 评论(0) 收藏
    oracle数据库的随堂笔记(四)-定义并使用变量
    oracle数据库的随堂笔记(三)-过程、函数、触发器
    oracle数据库的随堂笔记(二)-块
    oracle数据库的随堂笔记(一)-常用操作
  • 原文地址:https://www.cnblogs.com/klh5211314/p/2703077.html
Copyright © 2011-2022 走看看