亚洲精品中文字幕无乱码_久久亚洲精品无码AV大片_最新国产免费Av网址_国产精品3级片

動畫設計

Flash CS制作幸運大抽獎gif動畫特效的教程方法

時間:2024-10-26 19:20:45 動畫設計 我要投稿
  • 相關(guān)推薦

Flash CS制作幸運大抽獎gif動畫特效的教程方法

  好久未來這了,剛好這兩天沒什么事,又做了一個抽獎的小東東玩玩,只供菜鳥們參考,老鳥們見笑了。

  照慣例上主要代碼:

  復制代碼代碼如下:stop();

  /*

  @sxl

  @QQ:285510591

  @http://sxl001.129hb.com

  @2009.12.20

  */

  System.useCodePage =true;

  // title_mc:標題 | gong_mc:顯示中獎 | msg_mc:顯示所有中獎和未中獎情況

  title_mc.cacheAsBitmap=true;

  gong_mc.cacheAsBitmap=true;

  gong_mc.y=1000;

  msg_mc.cacheAsBitmap=true;

  msg_mc.x=-1000;

  // 下列是聲音效果數(shù)據(jù)

  var mousw_over_sound:Over=new Over(),rect_up_sound:Move=new Move(),rect_down_soundown=new Down(),_win:Win=new Win();

  // gong_array:獎品名 | Balls:各個號碼 | hit_ball_array:已抽號碼

  var gong_array:Array =[],Balls:Array =[],hit_ball_array:Array =[],move_gong_mc:Boolean=true,move_msg_mc:Boolean;

  // 以下是內(nèi)部設置獎品

  var data_str:String ="環(huán)保手提袋|羅技|電磁爐|顯示器|移動硬盤|掌上游戲機|手機|3G手機|九陽豆?jié){機|電動剃須刀|雅頓香水|數(shù)碼相機|閃存盤|離子電視|消毒柜|松下洗衣機|電磁爐|電飯煲|電壓力鍋|光波爐|攪拌機|榨汁機|電茶壺|咖啡機|自動烹飪鍋|紫砂煲|空調(diào)|吸油煙機|取暖器|加濕器";

  gong_array =data_str.split("|");

  randomArray(gong_array);

  /* 以下注釋部分是從外部文本中導入獎品數(shù)據(jù)

  var loaderNum:URLLoader = new URLLoader();

  configureListenersNum(loaderNum);

  var urlNum:String ="data/獎品.txt";

  var requestNum:URLRequest=new URLRequest(urlNum);

  loaderNum.load(requestNum);

  function configureListenersNum(dispatcher:IEventDispatcher):void {

  dispatcher.addEventListener(Event.COMPLETE, completeHNum);

  dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);

  }

  function completeHNum(event:Event):void {

  gong_array =event.target.data.split("|");

  randomArray(gong_array);

  event.target.removeEventListener(Event.COMPLETE, completeHNum);

  event.target.removeEventListener(Event.COMPLETE, ioErrorHandler);

  }

  function ioErrorHandler(event:IOErrorEvent):void {

  dele_balls_seleabled();

  chakan_mc.buttonMode =false;

  chakan_mc.removeEventListener(MouseEvent.MOUSE_OVER ,onMouse_Click);

  chakan_mc.removeEventListener(MouseEvent.MOUSE_DOWN ,onMouse_Click);

  chakan_mc.removeEventListener(MouseEvent.MOUSE_OUT ,onMouse_Click);

  gong_mc._txt.text="請檢查數(shù)據(jù)";

  gong_mc.Ball._txt.text="-_-";

  gong_mc.addEventListener(Event.ENTER_FRAME,move_gong_mc_rect);

  gong_mc.close_btn.enabled=false;

  gong_mc.close_btn.removeEventListener(MouseEvent.MOUSE_DOWN,onCloseShowGong);

  event.target.removeEventListener(Event.COMPLETE, completeHNum);

  event.target.removeEventListener(Event.COMPLETE, ioErrorHandler);

  }

  */

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

  this["Ball" + i].cacheAsBitmap=true;

  this["Ball" + i].gotoAndStop("one");

  Balls.push(this["Ball" + i]);

  msg_mc["m" + i].ball_mc.gotoAndStop("one");

  if (i<9) {

  this["Ball"+i]._txt.text="0"+uint(i+1);

  msg_mc["m"+i].ball_mc._txt.text="0"+uint(i+1);

  } else {

  this["Ball"+i]._txt.text=""+uint(i+1);

  msg_mc["m"+i].ball_mc._txt.text=""+uint(i+1);

  }

  msg_mc["m"+i].t.text="等 待 抽 獎";

  this["Ball"+i].i=i;

  this["Ball"+i].buttonMode =true;

  this["Ball"+i].mouseChildren=false;

  this["Ball" + i].addEventListener(MouseEvent.MOUSE_OVER ,onMouse_Click);

  this["Ball" + i].addEventListener(MouseEvent.MOUSE_DOWN ,onMouse_Click);

  this["Ball" + i].addEventListener(MouseEvent.MOUSE_OUT ,onMouse_Click);

  //......

  }

  chakan_mc.buttonMode =true;

  chakan_mc.mouseChildren=false;

  chakan_mc.addEventListener(MouseEvent.MOUSE_OVER ,onMouse_Click);

  chakan_mc.addEventListener(MouseEvent.MOUSE_DOWN ,onMouse_Click);

  chakan_mc.addEventListener(MouseEvent.MOUSE_OUT ,onMouse_Click);

  function onMouse_Click(sxl:MouseEvent) {

  var target:MovieClip =sxl.currentTarget as MovieClip;

  var target_name:String =target.name.substr(0,1);

  switch (sxl.type) {

  case "mouseOver" :

  mousw_over_sound.play();

  switch (target_name) {

  case "B" :

  getBitmapFilter(target);

  break;

  case "c" :

  setTxtColor(target.t,0xFFFFFF);

  break;

  }

  break;

  case "mouseOut" :

  switch (target_name) {

  case "B" :

  target.filters =null;

  break;

  case "c" :

  setTxtColor(target.t,0xFFFF00);

  break;

  }

  break;

  case "mouseDown" :

  switch (target_name) {

  case "B" :

  dele_balls_seleabled();

  target.removeEventListener(MouseEvent.CLICK ,onMouse_Click);

  target.gotoAndStop("two");

  setTxtColor(target._txt);

  var index:String =target.i;

  hit_ball_array.push(target);

  var str:uint =uint(target.name.substr(4));

  if (str<9) {

  gong_mc.Ball._txt.text="0"+uint(str+1);

  } else {

  gong_mc.Ball._txt.text=""+uint(str+1);

  }

  gong_mc._txt.text=gong_array[index];

  gong_mc.addEventListener(Event.ENTER_FRAME,move_gong_mc_rect);

  rect_up_sound.play();

  msg_mc["m" + index].ball_mc.play();

  msg_mc["m"+index].t.text=gong_array[index];

  setTxtColor(msg_mc["m"+index].t,0xffff00);

  setTxtColor(msg_mc["m" + index].ball_mc._txt);

  break;

  case "c" :

  target.t.text="移開中獎結(jié)果";

  if (Math.abs(gong_mc.y-300)<10) {

  move_gong_mc=false;

  gong_mc.addEventListener(Event.ENTER_FRAME,move_gong_mc_rect);

  }

  move_msg_mc=!move_msg_mc;

  msg_mc.addEventListener(Event.ENTER_FRAME,show_msg_mc);

  rect_up_sound.play();

  break;

  }

  break;

  }

  }

  //

  function show_msg_mc(sxl:Event) {

  if (move_msg_mc) {

  var dis_up:Number =(354-sxl.target.x)/5;

  sxl.target.x+=dis_up;

  if (Math.abs(dis_up)<1) {

  sxl.target.x=354;

  sxl.target.removeEventListener(Event.ENTER_FRAME,show_msg_mc);

  }

  } else {

  var dis_down:Number =(1800-sxl.target.x)/5;

  sxl.target.x+=dis_down;

  if (Math.abs(dis_down)<10) {

  chakan_mc.t.text="查看中獎結(jié)果";

  sxl.target.x=-1000;

  sxl.target.removeEventListener(Event.ENTER_FRAME,show_msg_mc);

  }

  }

  }

  // 刪除所有數(shù)字按鈕功能

  function dele_balls_seleabled() {

  for (var i:uint =0; i<Balls.length; i++) {

  var A:MovieClip =Balls;

  A.buttonMode =false;

  A.removeEventListener(MouseEvent.MOUSE_OVER ,onMouse_Click);

  A.removeEventListener(MouseEvent.MOUSE_DOWN ,onMouse_Click);

  A.removeEventListener(MouseEvent.MOUSE_OUT ,onMouse_Click);

  }

  }

  // 啟用可用數(shù)字按鈕功能

  function show_balls_seleabled(A_arr:Array,B_arr:Array) {

  var A_array:Array=A_arr,B_array:Array=B_arr;

  for (var i:uint =0; i<A_array.length; i++) {

  var A:MovieClip =A_array;

  A.buttonMode =true;

  A.mouseChildren=false;

  A.addEventListener(MouseEvent.MOUSE_OVER ,onMouse_Click);

  A.addEventListener(MouseEvent.MOUSE_DOWN ,onMouse_Click);

  A.addEventListener(MouseEvent.MOUSE_OUT ,onMouse_Click);

  }

  for (var j:uint =0; j<B_array.length; j++) {

  var B:MovieClip =B_array[j];

  B.filters =null;

  B.buttonMode =false;

  B.removeEventListener(MouseEvent.MOUSE_OVER ,onMouse_Click);

  B.removeEventListener(MouseEvent.MOUSE_DOWN ,onMouse_Click);

  B.removeEventListener(MouseEvent.MOUSE_OUT ,onMouse_Click);

  }

  }

  gong_mc.close_btn.addEventListener(MouseEvent.MOUSE_DOWN,onCloseShowGong);

  function onCloseShowGong(sxl:MouseEvent) {

  rect_down_sound.play();

  gong_mc.addEventListener(Event.ENTER_FRAME,move_gong_mc_rect);

  }

  function move_gong_mc_rect(sxl:Event) {

  if (move_gong_mc) {

  var dis_up:Number =(300-sxl.target.y)/5;

  sxl.target.y+=dis_up;

  if (Math.abs(dis_up)<1) {

  _win.play();

  sxl.target.gold.play();

  sxl.target.y=300;

  sxl.target.removeEventListener(Event.ENTER_FRAME,move_gong_mc_rect);

  move_gong_mc=false;

  }

  } else {

  var dis_down:Number =(1000-sxl.target.y)/5;

  sxl.target.y+=dis_down;

  if (Math.abs(dis_down)<10) {

  sxl.target.y=1000;

  sxl.target.removeEventListener(Event.ENTER_FRAME,move_gong_mc_rect);

  move_gong_mc=true;

  show_balls_seleabled(Balls,hit_ball_array);

  }

  }

  }

  function randomArray(Target_array:Array):void {

  Target_array.sort(function () {

  return Math.round(Math.random()) ? 1 : -1;

  });

  }

  function setTxtColor(_txt:TextField,color:uint=0x666666) {

  var my_TextFormat:TextFormat =new TextFormat();

  my_TextFormat.color =color;

  _txt.defaultTextFormat = my_TextFormat;

  _txt.setTextFormat(my_TextFormat);

  }

  //... 投影

  function getBitmapFilter(_mc:MovieClip) {

  var color:Number = 0x000000;

  var angle:Number = 45;

  var alpha:Number = 0.8;

  var blurX:Number = 8;

  var blurY:Number = 8;

  var distance:Number = 15;

  var strength:Number = 0.65;

  var inner:Boolean = false;

  var knockout:Boolean = false;

  var quality:Number = BitmapFilterQuality.HIGH;

  var myDropShadowFilterropShadowFilter= new DropShadowFilter(distance,angle,color,alpha,blurX,blurY,strength,quality,inner,knockout);

  _mc.filters =[myDropShadowFilter];

  }

  以上就是Flash CS制作幸運大抽獎gif動畫特效教程,希望大家喜歡!

【Flash CS制作幸運大抽獎gif動畫特效的教程方法】相關(guān)文章:

flash動畫制作說課稿(精選11篇)03-06

flash動畫設計與制作說課稿11-20

Flash動畫制作要求及評價標準解析06-25

ppt中插入Flash動畫四種方法09-05

建筑動畫的制作流程09-05

excel制作圓餅圖的教程09-28

定格動畫的制作流程是怎樣的?03-09

動畫制作協(xié)議04-06

古琴制作方法09-19

制作風箏的方法05-03