资源介绍
flash下雨特效,flash随机下雨代码。记得很久以前,会写flash下雨效果非常自豪,它不是简简单单的做很多下雨的影片剪辑,然后不断的添加到舞台上,那不是随机。这里的雨是随机的,其实很简单,先做一个雨滴下落的mc,然后写一段AS,随机旋转一定角度和随机改变位置,然后用duplicateMovieClip不断复制即可,代码如下:
1 | n = Number(n) + 1; |
2 | setProperty( "raindrop" , _x, -30 + Math.random() * 452); |
3 | setProperty( "raindrop" , _y, -35 + Math.random() * 33); |
4 | duplicateMovieClip( "raindrop" , "" , n); |
使用方法
将下面的代码插入html中即可:
1 | < object classid = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width = "450" height = "280" > |
2 | < param name = "movie" value = "flash2860.swf" /> |
3 | < param name = "quality" value = "high" /> |
4 | < embed src = "flash2860.swf" quality = "high" pluginspage = "http://www.macromedia.com/go/getflashplayer" type = "application/x-shockwave-flash" width = "450" height = "280" ></ embed > |
5 | </ object > |