Section 1
//MainTimeline (falling_snowv2_fla.MainTimeline)
package falling_snowv2_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.ui.*;
import flash.filters.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.geom.*;
import flash.printing.*;
import flash.system.*;
import flash.text.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var my_menu:ContextMenu;
public var tempo;
public var mouseIsOver;
public var bandcamp;
public var flakeData:Array;
public var sc:SoundChannel;
public var goingright;
public var more;
public var snowglow:GlowFilter;
public var soundcloud;
public var maxheight;
public var cpu;
public var flakeShape:Array;
public var mus:music;
public var maxwidth;
public var credit;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
public function returnHandler(_arg1:Event):void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, returnHandler);
mouseIsOver = true;
}
public function initphys(_arg1:Number){
flakeData[_arg1].velocityX = ((Math.random() - 0.5) * flakeData[_arg1].flakeRadius);
flakeData[_arg1].velocityY = (1 + (Math.random() * 2));
flakeShape[_arg1].x = 0;
flakeShape[_arg1].y = 0;
}
public function updateAll(_arg1, _arg2){
var _local3:*;
_local3 = _arg1;
while (_local3 < _arg2) {
updatephys(_local3);
_local3++;
};
}
public function randomix(_arg1:Number){
flakeShape[_arg1].x = Math.round((Math.random() * maxwidth));
flakeShape[_arg1].y = Math.round((Math.random() * maxheight));
}
public function openSCLink(_arg1:ContextMenuEvent):void{
navigateToURL(new URLRequest("https://soundcloud.com/9c5"));
}
public function updatephys(_arg1:Number){
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
if (mouseIsOver){
_local2 = (flakeShape[_arg1].x - stage.mouseX);
_local3 = (flakeShape[_arg1].y - stage.mouseY);
_local4 = Math.sqrt((Math.pow(_local2, 2) + Math.pow(_local3, 2)));
if (_local4 > 0){
_local5 = _local3;
if (_local5 == 0){
_local5 = 0.01;
};
_local6 = _local2;
_local7 = Math.atan(Math.abs((_local5 / _local6)));
_local8 = (30 / (_local4 * flakeData[_arg1].flakeRadius));
_local9 = (_local8 * Math.cos(_local7));
_local10 = (_local8 * Math.sin(_local7));
if (flakeShape[_arg1].x < stage.mouseX){
_local9 = (-1 * _local9);
};
if (flakeShape[_arg1].y < stage.mouseY){
_local10 = (-1 * _local10);
};
flakeData[_arg1].velocityX = (flakeData[_arg1].velocityX + _local9);
flakeData[_arg1].velocityY = (flakeData[_arg1].velocityY + _local10);
};
};
if (Math.abs(flakeData[_arg1].velocityX) > flakeData[_arg1].flakeRadius){
flakeData[_arg1].velocityX = (flakeData[_arg1].velocityX * 0.8);
} else {
if (Math.random() < 0.3){
flakeData[_arg1].velocityX = ((flakeData[_arg1].velocityX + Math.random()) - 0.5);
};
};
if (((((goingright * flakeData[_arg1].velocityX) < 0)) && ((Math.random() < 0.7)))){
flakeData[_arg1].velocityX = (-1 * flakeData[_arg1].velocityX);
};
if (Math.abs(flakeData[_arg1].velocityY) > 4){
flakeData[_arg1].velocityY = (flakeData[_arg1].velocityY * 0.8);
} else {
if (flakeData[_arg1].velocityY < 4){
flakeData[_arg1].velocityY = (flakeData[_arg1].velocityY + (Math.random() * (0.3 / flakeData[_arg1].flakeRadius)));
};
};
flakeShape[_arg1].y = Math.round((flakeShape[_arg1].y + flakeData[_arg1].velocityY));
flakeShape[_arg1].x = Math.round((flakeShape[_arg1].x + flakeData[_arg1].velocityX));
if (flakeShape[_arg1].y > maxheight){
flakeShape[_arg1].y = 0;
flakeShape[_arg1].x = (Math.random() * maxwidth);
} else {
if (flakeShape[_arg1].x > maxwidth){
flakeShape[_arg1].x = 0;
} else {
if (flakeShape[_arg1].x < 0){
flakeShape[_arg1].x = maxwidth;
};
};
};
}
public function initdraw(_arg1:Number){
flakeShape[_arg1].graphics.beginFill(0xFFFFFF, Math.random());
flakeShape[_arg1].graphics.drawCircle(flakeShape[_arg1].x, flakeShape[_arg1].y, flakeData[_arg1].flakeRadius);
flakeShape[_arg1].graphics.endFill();
stage.addChild(flakeShape[_arg1]);
flakeShape[_arg1].filters = [snowglow];
}
function frame3(){
gotoAndPlay(2);
}
function frame1(){
my_menu = new ContextMenu();
my_menu.hideBuiltInItems();
credit = new ContextMenuItem("Rubber NAND 2015");
credit.enabled = false;
soundcloud = new ContextMenuItem("Soundcloud");
soundcloud.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, openSCLink);
soundcloud.separatorBefore = true;
bandcamp = new ContextMenuItem("Bandcamp");
bandcamp.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, openBCLink);
cpu = new ContextMenuItem("Help! My CPU can't handle this!");
cpu.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, cpusaver);
cpu.separatorBefore = true;
more = new ContextMenuItem("I've got cycles to spare! Bring it on!");
more.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, morepain);
my_menu.customItems.push(credit, soundcloud, bandcamp, cpu, more);
contextMenu = my_menu;
sc = new SoundChannel();
mus = new music();
sc = mus.play(0, int.MAX_VALUE);
tempo = 500;
maxwidth = stage.stageWidth;
maxheight = stage.stageHeight;
mouseIsOver = false;
stage.addEventListener(Event.MOUSE_LEAVE, leaveHandler);
stage.addEventListener(MouseEvent.MOUSE_MOVE, returnHandler);
goingright = 1;
snowglow = new GlowFilter();
snowglow.color = 0xFFFFFF;
snowglow.alpha = 0.7;
snowglow.blurX = 10;
snowglow.blurY = 10;
snowglow.quality = BitmapFilterQuality.LOW;
flakeShape = new Array();
flakeData = new Array();
populate(5000);
gotoAndPlay(2);
}
function frame2(){
updateAll(0, flakeShape.length);
}
public function initialize(_arg1:Number){
flakeData[_arg1].flakeRadius = Math.round((Math.random() * 3));
if (flakeData[_arg1].flakeRadius == 0){
flakeData[_arg1].flakeRadius = 1;
};
initphys(_arg1);
initdraw(_arg1);
randomix(_arg1);
}
public function openBCLink(_arg1:ContextMenuEvent):void{
navigateToURL(new URLRequest("https://jamesjerram.bandcamp.com/"));
}
public function leaveHandler(_arg1:Event):void{
stage.addEventListener(MouseEvent.MOUSE_MOVE, returnHandler);
mouseIsOver = false;
}
public function morepain(_arg1:ContextMenuEvent):void{
populate(flakeShape.length);
}
public function cpusaver(_arg1:ContextMenuEvent):void{
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = Math.round((flakeShape.length / 2));
_local3 = flakeShape.splice(0, _local2);
_local4 = 0;
while (_local4 < _local3.length) {
stage.removeChild(_local3[_local4]);
_local4++;
};
flakeData.splice(0, _local2);
}
public function populate(_arg1){
var _local2:*;
var _local3:*;
_local2 = flakeShape.length;
_local3 = 0;
while (_local3 < _arg1) {
flakeShape.push(new Shape());
flakeData.push(new FlakeData2());
initialize((_local2 + _local3));
_local3++;
};
}
}
}//package falling_snowv2_fla
Section 2
//FlakeData2 (FlakeData2)
package {
public class FlakeData2 {
public var velocityX:Number;
public var velocityY:Number;
public var flakeRadius:Number;
}
}//package
Section 3
//music (music)
package {
import flash.media.*;
public dynamic class music extends Sound {
}
}//package