Section 1
//MainTimeline (falling_snow_fla.MainTimeline)
package falling_snow_fla {
import flash.events.*;
import flash.display.*;
import flash.media.*;
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 sc:SoundChannel;
public var goingright;
public var flakeArray:Array;
public var more;
public var snowglow:GlowFilter;
public var soundcloud;
public var maxheight;
public var cpu;
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:FlakeData){
_arg1.posX = 0;
_arg1.posY = 0;
_arg1.velocityX = ((Math.random() - 0.5) * _arg1.flakeradius);
_arg1.velocityY = (1 + (Math.random() * 2));
_arg1.flake.x = _arg1.posX;
_arg1.flake.y = _arg1.posY;
}
public function updateAll(){
var _local1:*;
_local1 = 0;
while (_local1 < flakeArray.length) {
updatephys(flakeArray[_local1]);
_local1++;
};
trace(flakeArray);
}
public function randomix(_arg1:FlakeData){
_arg1.posX = Math.round((Math.random() * maxwidth));
_arg1.posY = Math.round((Math.random() * maxheight));
_arg1.flake.x = _arg1.posX;
_arg1.flake.y = _arg1.posY;
}
public function openSCLink(_arg1:ContextMenuEvent):void{
navigateToURL(new URLRequest("https://soundcloud.com/9c5"));
}
public function updatephys(_arg1:FlakeData){
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
if (Math.abs(_arg1.velocityX) > _arg1.flakeradius){
_arg1.velocityX = (_arg1.velocityX * 0.8);
} else {
if (Math.random() < 0.3){
if (_arg1.velocityX >= 0){
_arg1.velocityX = ((_arg1.velocityX + Math.random()) - 0.5);
} else {
_arg1.velocityX = ((_arg1.velocityX - Math.random()) + 0.5);
};
} else {
if (Math.random() < 0.001){
_arg1.velocityX = (-1 * _arg1.velocityX);
};
};
};
if (((((goingright * _arg1.velocityX) < 0)) && ((Math.random() < 0.7)))){
_arg1.velocityX = (-1 * _arg1.velocityX);
};
_arg1.posY = Math.round((_arg1.posY + _arg1.velocityY));
_arg1.posX = Math.round((_arg1.posX + _arg1.velocityX));
if (mouseIsOver){
_local2 = (_arg1.posX - stage.mouseX);
_local3 = (_arg1.posY - 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 * _arg1.flakeradius));
_local9 = (_local8 * Math.cos(_local7));
_local10 = (_local8 * Math.sin(_local7));
if (_arg1.posX < stage.mouseX){
_local9 = (-1 * _local9);
};
if (_arg1.posY < stage.mouseY){
_local10 = (-1 * _local10);
};
_arg1.velocityX = (_arg1.velocityX + _local9);
_arg1.velocityY = (_arg1.velocityY + _local10);
};
};
if (Math.abs(_arg1.velocityY) > 4){
_arg1.velocityY = (_arg1.velocityY * 0.8);
};
if (_arg1.velocityY < 4){
_arg1.velocityY = (_arg1.velocityY + (Math.random() * (0.3 / _arg1.flakeradius)));
};
if (_arg1.posX < 0){
_arg1.posX = maxwidth;
} else {
if (_arg1.posX > maxwidth){
_arg1.posX = 0;
};
};
if (_arg1.posY > maxheight){
_arg1.posY = 0;
_arg1.posX = (Math.random() * maxwidth);
};
_arg1.flake.x = _arg1.posX;
_arg1.flake.y = _arg1.posY;
}
public function initdraw(_arg1:FlakeData){
_arg1.flake.graphics.beginFill(0xFFFFFF, Math.random());
_arg1.flake.graphics.drawCircle(_arg1.posX, _arg1.posY, _arg1.flakeradius);
_arg1.flake.graphics.endFill();
stage.addChild(_arg1.flake);
_arg1.flake.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;
flakeArray = new Array();
populate(5000);
gotoAndPlay(2);
}
function frame2(){
updateAll();
}
public function initialize(_arg1:FlakeData){
_arg1.flakeradius = Math.round((Math.random() * 3));
if (_arg1.flakeradius == 0){
_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(flakeArray.length);
}
public function cpusaver(_arg1:ContextMenuEvent):void{
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = Math.round((flakeArray.length / 2));
_local3 = flakeArray.splice(0, _local2);
_local4 = 0;
while (_local4 < _local3.length) {
stage.removeChild(_local3[_local4].flake);
_local4++;
};
}
public function populate(_arg1){
var _local2:*;
var _local3:*;
_local2 = flakeArray.length;
_local3 = 0;
while (_local3 < _arg1) {
flakeArray.push(new FlakeData());
initialize(flakeArray[(_local2 + _local3)]);
_local3++;
};
}
}
}//package falling_snow_fla
Section 2
//FlakeData (FlakeData)
package {
import flash.display.*;
public class FlakeData {
public var posX;
public var posY;
public var flakeradius;
public var flake:Shape;
public var velocityX;
public var velocityY;
public function FlakeData(){
flake = new Shape();
}
}
}//package
Section 3
//music (music)
package {
import flash.media.*;
public dynamic class music extends Sound {
}
}//package