Section 1
//BitmapAsset (mx.core.BitmapAsset)
package mx.core {
import flash.display.*;
public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject {
mx_internal static const VERSION:String = "2.0.1.0";
public function BitmapAsset(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
public function get measuredWidth():Number{
if (bitmapData){
return (bitmapData.width);
};
return (0);
}
public function get measuredHeight():Number{
if (bitmapData){
return (bitmapData.height);
};
return (0);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
}
}//package mx.core
Section 2
//FlexBitmap (mx.core.FlexBitmap)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexBitmap extends Bitmap {
mx_internal static const VERSION:String = "2.0.1.0";
public function FlexBitmap(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
var bitmapData = _arg1;
var pixelSnapping = _arg2;
var smoothing = _arg3;
super(bitmapData, pixelSnapping, smoothing);
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 3
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 4
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.events.*;
import flash.display.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get name():String;
function set width(_arg1:Number):void;
function get measuredHeight():Number;
function set height(_arg1:Number):void;
function get scaleY():Number;
function move(_arg1:Number, _arg2:Number):void;
function get scaleX():Number;
function set mask(_arg1:DisplayObject):void;
function set scaleX(_arg1:Number):void;
function set name(_arg1:String):void;
function set scaleY(_arg1:Number):void;
function get visible():Boolean;
function get measuredWidth():Number;
function set visible(_arg1:Boolean):void;
function get alpha():Number;
function get height():Number;
function get width():Number;
function get parent():DisplayObjectContainer;
function get mask():DisplayObject;
function set x(_arg1:Number):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set y(_arg1:Number):void;
function get x():Number;
function get y():Number;
function set alpha(_arg1:Number):void;
}
}//package mx.core
Section 5
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function set instanceIndices(_arg1:Array):void;
function get isDocument():Boolean;
function get repeaters():Array;
function get instanceIndices():Array;
function set repeaters(_arg1:Array):void;
function initializeRepeaterArrays(_arg1:IRepeaterClient):void;
function set repeaterIndices(_arg1:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 6
//mx_internal (mx.core.mx_internal)
package mx.core {
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
}//package mx.core
Section 7
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import mx.core.*;
import flash.utils.*;
public class NameUtil {
mx_internal static const VERSION:String = "2.0.1.0";
private static var counter:int = 0;
public static function displayObjectToString(_arg1:DisplayObject):String{
var _local2:String;
var _local3:DisplayObject;
var _local4:String;
var _local5:Array;
_local3 = _arg1;
while (_local3 != null) {
if (((((_local3.parent) && (_local3.stage))) && ((_local3.parent == _local3.stage)))){
break;
};
_local4 = _local3.name;
if ((_local3 is IRepeaterClient)){
_local5 = IRepeaterClient(_local3).instanceIndices;
if (_local5){
_local4 = (_local4 + (("[" + _local5.join("][")) + "]"));
};
};
_local2 = ((_local2 == null)) ? _local4 : ((_local4 + ".") + _local2);
_local3 = _local3.parent;
};
return (_local2);
}
public static function createUniqueName(_arg1:Object):String{
var _local2:String;
var _local3:int;
var _local4:int;
if (!_arg1){
return (null);
};
_local2 = getQualifiedClassName(_arg1);
_local3 = _local2.indexOf("::");
if (_local3 != -1){
_local2 = _local2.substr((_local3 + 2));
};
_local4 = _local2.charCodeAt((_local2.length - 1));
if ((((_local4 >= 48)) && ((_local4 <= 57)))){
_local2 = (_local2 + "_");
};
return ((_local2 + counter++));
}
}
}//package mx.utils
Section 8
//BG (BG)
package {
import flash.display.*;
public class BG {
private var list:Array;
public function BG():void{
var _local1:int;
list = new Array();
super();
_local1 = 0;
while (_local1 < 200) {
list.push(new Star());
_local1++;
};
}
public function draw(_arg1:BitmapData):void{
var _local2:Star;
for each (_local2 in list) {
_local2.draw(_arg1);
};
}
}
}//package
import flash.display.*;
class Star {
public var color:uint;
public var speed:Number;
public var x:Number;
public var y:Number;
private function Star():void{
x = (Math.random() * 160);
shuffle();
}
public function shuffle():void{
y = (Math.random() * 120);
speed = (Math.random() + 0.1);
color = (((Math.floor((Math.random() * 192)) * 65536) + (Math.floor((Math.random() * 192)) * 0x0100)) + (Math.random() * 192));
}
public function draw(_arg1:BitmapData):void{
x = (x - speed);
if (x < 0){
x = 160;
shuffle();
};
_arg1.setPixel(x, y, color);
}
}
Section 9
//darius (darius)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class darius extends Sprite {
private var destfps:Number;
private var count:int;// = 0
private var bg:BG;
private var fish:Fish;
private var screen:BitmapData;
private var pretimer:Number;
private var bmp:Bitmap;
public function darius():void{
screen = new BitmapData(160, 120, false, 0);
bmp = new Bitmap(screen);
count = 0;
super();
bmp.scaleX = (bmp.scaleY = 2);
addChild(bmp);
stage.quality = StageQuality.LOW;
fish = new Fish();
bg = new BG();
addEventListener(Event.ENTER_FRAME, tunefps);
}
private function main(_arg1:Event):void{
screen.fillRect(screen.rect, 0x181818);
bg.draw(screen);
fish.main();
fish.draw(screen);
}
public function tunefps(_arg1:Event):void{
var _local2:Number;
if (count == 0){
destfps = stage.frameRate;
pretimer = getTimer();
} else {
if ((count % 18) == 0){
_local2 = (getTimer() - pretimer);
pretimer = getTimer();
if (_local2 < (((1000 / destfps) * 18) - 20)){
stage.frameRate = (stage.frameRate - 2.5);
} else {
if (_local2 > (((1000 / destfps) * 18) + 20)){
stage.frameRate = (stage.frameRate + 5);
} else {
removeEventListener(Event.ENTER_FRAME, tunefps);
addEventListener(Event.ENTER_FRAME, main);
return;
};
};
};
};
if (count == (18 * 10)){
removeEventListener(Event.ENTER_FRAME, tunefps);
addEventListener(Event.ENTER_FRAME, main);
return;
};
count++;
}
}
}//package
Section 10
//Fish (Fish)
package {
import flash.display.*;
import flash.geom.*;
public class Fish {
public var parts:Array;
public var dest:Number;// = 128
public var dir:Number;// = 128
private var BMP_Fish:Class;
public var dirlog:Array;
public var x:Number;// = 100
public var y:Number;// = 8
public var z:Number;// = 200
public function Fish():void{
var _local1:BitmapData;
var _local2:BitmapData;
var _local3:Matrix;
var _local4:int;
var _local5:Segment;
BMP_Fish = Fish_BMP_Fish;
parts = new Array();
x = 100;
y = 8;
z = 200;
dir = 128;
dest = 128;
dirlog = new Array();
super();
_local1 = new BMP_Fish().bitmapData;
_local2 = new BitmapData(1088, 560, true, 0);
_local2.copyPixels(_local1, _local1.rect, new Point(0, 0));
_local3 = new Matrix();
_local3.scale(-1, 1);
_local3.translate(1088, 0);
_local2.draw(_local1, _local3, null, null, new Rectangle(576, 0, 448, 560));
_local4 = 0;
while (_local4 < 7) {
_local5 = new Segment(_local2, _local4);
parts.push(_local5);
_local4++;
};
parts[0].distance = 22;
parts[1].distance = 16;
parts[2].distance = 14;
parts[3].distance = 11;
parts[4].distance = 12;
parts[5].distance = 12;
_local4 = 0;
while (_local4 < ((7 * 3) + 5)) {
dirlog.unshift(dir);
_local4++;
};
}
public function main():void{
var _local1:int;
var _local2:Segment;
var _local3:Segment;
x = (x + MathEx.getVectorX(dir, 2));
z = (z + MathEx.getVectorY(dir, 2));
if (x < -130){
x = -130;
};
if (x > 130){
x = 130;
};
if (z < 200){
z = 200;
};
if (z > 500){
z = 500;
};
if (Math.random() < 0.03){
dest = (Math.floor((Math.random() * 16)) * 16);
};
if (MathEx.getBearing(dir, dest) < -2){
dir = (dir + 4);
} else {
if (MathEx.getBearing(dir, dest) > 2){
dir = (dir - 4);
};
};
parts[0].x = x;
parts[0].y = y;
parts[0].z = z;
parts[0].dir = dir;
dirlog.pop();
dirlog.unshift(dir);
_local1 = 1;
while (_local1 < parts.length) {
_local2 = parts[_local1];
_local3 = parts[(_local1 - 1)];
_local2.x = (_local3.x + MathEx.getVectorX(_local3.dir, -(_local3.distance)));
_local2.z = ((_local3.z + MathEx.getVectorY(_local3.dir, -(_local3.distance))) + 0.1);
_local2.y = _local3.y;
_local2.dir = dirlog[((_local1 * 3) + 5)];
_local1++;
};
}
public function draw(_arg1:BitmapData):void{
var _local2:Array;
var _local3:int;
_local2 = parts.concat();
_local2.sortOn("z", Array.DESCENDING);
_local3 = 0;
while (_local3 < _local2.length) {
_local2[_local3].draw(_arg1);
_local3++;
};
}
}
}//package
import flash.display.*;
import flash.geom.*;
class Segment {
private var matrix:Matrix;
private var frames:Array;
public var dir:Number;// = 128
public var distance:Number;// = 15
public var x:Number;// = 0
public var y:Number;// = 0
public var z:Number;// = 200
private function Segment(_arg1:BitmapData, _arg2:int):void{
var _local3:int;
var _local4:BitmapData;
frames = new Array();
matrix = new Matrix();
x = 0;
y = 0;
z = 200;
dir = 128;
distance = 15;
super();
_local3 = 0;
while (_local3 < 16) {
_local4 = new BitmapData(64, 80, true, 0);
_local4.copyPixels(_arg1, new Rectangle((_local3 * 64), (_arg2 * 80), 64, ((_arg2 * 80) + 80)), new Point(0, 0));
frames.push(_local4);
_local3++;
};
}
public function draw(_arg1:BitmapData):void{
matrix.identity();
matrix.translate(-32, -44);
matrix.scale((200 / z), (200 / z));
matrix.translate((((x * 200) / z) + 80), (((y * 200) / z) + 60));
if (dir < 0){
dir = ((dir % 0x0100) + 0x0100);
};
_arg1.draw(frames[(Math.floor((((dir + 8) / 16) + 12)) % 16)], matrix);
}
}
Section 11
//Fish_BMP_Fish (Fish_BMP_Fish)
package {
import mx.core.*;
public class Fish_BMP_Fish extends BitmapAsset {
}
}//package
Section 12
//MathEx (MathEx)
package {
public class MathEx {
public static function getVectorY(_arg1:Number, _arg2:Number):Number{
return ((Math.sin(((Math.PI / 128) * _arg1)) * _arg2));
}
public static function rand_int(_arg1:int, _arg2:int):int{
return (Math.floor(((Math.random() * ((_arg2 - _arg1) + 1)) + _arg1)));
}
public static function normalizeAngle(_arg1:Number):Number{
if (_arg1 < -128){
_arg1 = (0x0100 - (-(_arg1) % 0x0100));
};
_arg1 = (((_arg1 + 128) % 0x0100) - 128);
return (_arg1);
}
public static function getBearing(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
_local3 = normalizeAngle(_arg1);
_local4 = normalizeAngle(_arg2);
if ((_local4 - 128) > _local3){
_local3 = (_local3 + 0x0100);
};
if ((_local4 + 128) < _local3){
_local3 = (_local3 - 0x0100);
};
return ((_local3 - _local4));
}
public static function addZero(_arg1:Number, _arg2:int):String{
if (_arg1.toString().length <= _arg2){
return (((1 << (_arg2 - String(_arg1).length)).toString(2).substr(1) + _arg1));
};
return (String((Math.pow(10, _arg2) - 1)));
}
public static function rand(_arg1:Number, _arg2:Number):Number{
return (((Math.random() * (_arg2 - _arg1)) + _arg1));
}
public static function getVectorX(_arg1:Number, _arg2:Number):Number{
return ((Math.cos(((Math.PI / 128) * _arg1)) * _arg2));
}
}
}//package