萬盛學電腦網

 萬盛學電腦網 >> 圖文處理 >> Flash教程 >> 制作奔跑的駿馬代碼

制作奔跑的駿馬代碼

  var n:uint=0;

  var mysp:Sprite=new Sprite();

  mysp.y=80;

  addChild(mysp);

  for (var i:uint=0; i<4; i++) {

  var picmc:MovieClip=new Pic();

  picmc.x=i*picmc.width;

  picmc.scaleX=Math.pow(-1,i);

  mysp.addChild(picmc);

  }

  var pnkcy:Sound=new Pnyqkcy();

  var pnkCh:SoundChannel=new SoundChannel();

  var ps:Boolean=true;

  plst_mc.buttonMode=true;

  plst_mc.addEventListener(MouseEvent.CLICK,plst);

  function plst(ev:MouseEvent):void {

  if (ps) {

  addEventListener(Event.ENTER_FRAME,gctb);

  pnkCh=pnkcy.play();

  mp.play();

  mp1.play();

  plst_mc.gotoAndStop(2);

  } else {

  removeEventListener(Event.ENTER_FRAME,gctb);

  n=0;

  pnkCh.stop();

  mp.stop();

  mp1.stop();

  plst_mc.gotoAndStop(1);

  }

  ps=! ps;

  }

  var sj:Array=[1560,3560,5560,10600,23000,35000,43050,59810,71240,80370,89470,93930,98240,108479,122280,132360,146530,

  158160,166630,181080,196250,206060,216840,220120,224360,239720,243170,262440,271060,290250

  ];

  var gc:Array=["馬兒啊你慢些走","演唱:德德瑪","歌詞編輯:劉朋 QQ:406663870","馬兒啊你慢些走慢些走哎","我要把這壯麗的景色看個夠","社會主義建設改換了天地","勞動歌聲響遍了田野響徹了山頭","","沒見過一隊隊汽車雲中走","沒見過千裡平川跑鐵牛","沒見過渠水滾滾山上繞","沒見過天旱水澇保豐收","沒見過深山密林修工廠","沒見過公路通到深山溝深山溝","","馬兒啊你慢些走慢些走哎","我要把這大好的風光看個夠","風吹那稻麥卷起了千重浪","漫山遍野沉甸甸果實壓彎了枝頭","","碧綠的草地上牛羊成群走","新修的水庫中魚兒盡情游","場院上男女民兵練武藝","田野裡干部社員同揮鋤頭","眼望著新山新水新氣象","怎不教人笑在臉上","喜在心頭喜在心頭","哎祖國啊我愛你壯麗的景色","我想看個夠總也看不夠",""];

  function gctb(ev:Event):void {

  if (mysp.x>-2*picmc.width) {

  mysp.x-=5;

  } else {

  mysp.x=0;

  }

  if (pnkCh.position>=sj[n+1]) {

  n++;

  }

  gca_txt.text=gc[n];

  var gcb:String=gc[n];

  gcb_txt.text=gcb.substring(0,(gcb.length+2)*(pnkCh.position-sj[n])/(sj[n+1]-sj[n]));

  }

  //====馬

  var mp:MovieClip=new Mp();

  addChild(mp);

  mp.x=200;

  mp.y=200;

  mp.scaleX=0.5;

  mp.scaleY=0.5;

  var mp1:MovieClip=new Mp1();

  addChild(mp1);

  mp1.x=150;

  mp1.y=200;

  mp1.scaleX=0.45;

  mp1.scaleY=0.45;

copyright © 萬盛學電腦網 all rights reserved