码迷,mamicode.com
首页 > 其他好文 > 详细

飘雪效果的swf

时间:2016-08-14 12:53:56      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:

 

//第一帧动作
import flash.events.Event;

            
  for(var k:int=0;k<90;k++)
 {
   var xuehua:xue= new xue();
         xuehua.alpha = Math.random()+.3; 
            xuehua.height = xuehua.width = Math.random()*6+5;
         xuehua.x=Math.random()*550;
      xuehua.y=Math.random()*400;
         piaoxuekongjian.addChild(xuehua); 
 }
   

addEventListener(Event.ENTER_FRAME,webcyz);

function webcyz(e:Event)
{
 for(var k:int;k<3;k++)
 {
     var xuehua:xue= new xue();
     xuehua.alpha = Math.random()+.3; 
        xuehua.height = xuehua.width = Math.random()*6+5;
     xuehua.x=Math.random()*550;
     piaoxuekongjian.addChild(xuehua);        
 }
 //trace(piaoxuekongjian.numChildren);
 
  for(var i:int=0;i<piaoxuekongjian.numChildren;i++)
  {

   var mc:xue = xue(piaoxuekongjian.getChildAt(i));
   
   
   if(mc.y>400)
   {
   piaoxuekongjian.removeChild(mc);
   i--;      
   }
   else
   {
     mc.y+=Math.random()*6;
     mc.x+=(Math.random()-.5)*5;
   }
   
  }
 
}

 

 

//项目库中雪花的子类

package  {
 
 import flash.display.MovieClip;
 
 
 public class xue extends MovieClip {
  
  
  public function xue() {
   // constructor code
  }
 }
 
}

 

cs6源代码

飘雪效果的swf

标签:

原文地址:http://www.cnblogs.com/webcyz/p/5769768.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!