Section 1
//IContainer (com.kerb.sammy.hiphop.interfaces.IContainer)
package com.kerb.sammy.hiphop.interfaces {
public interface IContainer extends IStopable {
function setOrigin(_arg1:Number, _arg2:Number):void;
function getCount():uint;
function setInitialVelocity(_arg1:Number, _arg2:Number):void;
}
}//package com.kerb.sammy.hiphop.interfaces
Section 2
//IDisposable (com.kerb.sammy.hiphop.interfaces.IDisposable)
package com.kerb.sammy.hiphop.interfaces {
public interface IDisposable {
function dispose():void;
}
}//package com.kerb.sammy.hiphop.interfaces
Section 3
//IRenderable (com.kerb.sammy.hiphop.interfaces.IRenderable)
package com.kerb.sammy.hiphop.interfaces {
public interface IRenderable {
function render():void;
}
}//package com.kerb.sammy.hiphop.interfaces
Section 4
//IStopable (com.kerb.sammy.hiphop.interfaces.IStopable)
package com.kerb.sammy.hiphop.interfaces {
public interface IStopable {
function stop():void;
}
}//package com.kerb.sammy.hiphop.interfaces
Section 5
//IUpdateable (com.kerb.sammy.hiphop.interfaces.IUpdateable)
package com.kerb.sammy.hiphop.interfaces {
public interface IUpdateable {
function update():void;
}
}//package com.kerb.sammy.hiphop.interfaces
Section 6
//IVelocityOffset (com.kerb.sammy.hiphop.interfaces.IVelocityOffset)
package com.kerb.sammy.hiphop.interfaces {
public interface IVelocityOffset {
function setVYOffset(_arg1:Number):void;
}
}//package com.kerb.sammy.hiphop.interfaces
Section 7
//Note (com.kerb.sammy.hiphop.notes.Note)
package com.kerb.sammy.hiphop.notes {
import flash.display.*;
import com.kerb.sammy.hiphop.*;
import flash.geom.*;
import com.kerb.sammy.hiphop.interfaces.*;
import flash.utils.*;
final class Note implements IUpdateable, IRenderable, IDisposable {
private var _parent:Sprite;// = null
public var p:Point;
public var failedToCollect:Boolean;// = false
public var v:Point;
public var collecting:Boolean;// = false
private var _t0:uint;// = 0
public var clip:MovieClip;// = null
public static const BASE_SCALE:Number = 0.7;
private static const COLLECT_PERIOD:uint = 500;
function Note(_arg1:Sprite, _arg2:Number, _arg3:Number, _arg4:Number=0, _arg5:Number=0){
p = new Point();
v = new Point();
super();
_parent = _arg1;
var _local6:String = ((Math.random() < 0.5)) ? "Note1" : "Note2";
clip = (Global.af.createDisplayObject(_local6) as MovieClip);
clip.cacheAsBitmap = true;
clip.scaleX = (clip.scaleY = BASE_SCALE);
clip.visible = false;
clip.rotation = -90;
p.x = (clip.x = _arg2);
p.y = (clip.y = _arg3);
v.x = _arg4;
v.y = _arg5;
_parent.addChild(clip);
}
public function update():void{
var _local1:uint;
var _local2:Number;
p.x = (p.x + v.x);
p.y = (p.y + v.y);
if (collecting){
_local1 = (getTimer() - _t0);
_local2 = (_local1 / COLLECT_PERIOD);
if (_local2 > 1){
clip.visible = false;
} else {
clip.alpha = (1 - _local2);
clip.scaleX = (clip.scaleY = (BASE_SCALE + (2.5 * _local2)));
};
};
}
public function render():void{
clip.x = p.x;
clip.y = p.y;
}
public function dispose():void{
_parent.removeChild(clip);
}
public function collect():void{
collecting = true;
_t0 = getTimer();
}
}
}//package com.kerb.sammy.hiphop.notes
Section 8
//Notes (com.kerb.sammy.hiphop.notes.Notes)
package com.kerb.sammy.hiphop.notes {
import flash.events.*;
import flash.display.*;
import uk.kerb.utils.sound.*;
import com.kerb.sammy.hiphop.*;
import flash.geom.*;
import com.kerb.sammy.hiphop.interfaces.*;
import flash.utils.*;
public final class Notes extends EventDispatcher implements IUpdateable, IRenderable, IContainer, IVelocityOffset, IDisposable {
private var _container:Sprite;// = null
private var _stopped:Boolean;// = false
private var _v0:Number;// = 0
private var _consecutiveCollected:uint;// = 0
private var _active:Boolean;// = true
private var _notes:Array;// = null
private var _timer:Timer;// = null
private var _parent:Sprite;// = null
private var _collected:uint;// = 0
private var _sfxPoints:ExtendedSound;// = null
private var _t0:int;// = -1
private var _initialP:Point;
private var _initialV:Point;
private var _increaseVol:Boolean;// = false
private var _offsetVY:Number;// = 0
private var _v:Number;// = 0
private static const PERIOD:uint = 400;
public static const CONSECUTIVE_NOTE_BONUS:String = "ConsecutiveNoteBonus";
private static const D_SQUARED:uint = 2500;
private static const NUMBER_OF_NOTES:uint = 15;
private static const NUMBER_OF_COLOURS:uint = 4;
public static const CONSECUTIVE_NOTE_BONUS_SMALL:String = "ConsecutiveNoteBonusSmall";
public function Notes(_arg1:Sprite){
var _local3:Note;
_initialP = new Point();
_initialV = new Point();
super();
_parent = _arg1;
_container = new Sprite();
_parent.addChild(_container);
_timer = new Timer(PERIOD);
_timer.addEventListener(TimerEvent.TIMER, _onTimer);
_timer.start();
_notes = new Array(NUMBER_OF_NOTES);
var _local2:uint;
while (_local2 < NUMBER_OF_NOTES) {
_local3 = new Note(_container, -100, -100);
_notes[_local2] = _local3;
_local2++;
};
_sfxPoints = Global.af.createSound("SFXPoints");
}
public function setInitialVelocity(_arg1:Number, _arg2:Number):void{
_initialV.x = _arg1;
_initialV.y = _arg2;
}
public function setActive(_arg1:Boolean):void{
_active = _arg1;
}
public function isCloseTo(_arg1:uint, _arg2:Point):Boolean{
var _local3:Note = (_notes[_arg1] as Note);
if (_local3.collecting){
return (false);
};
var _local4:Number = (_arg2.x - _local3.p.x);
var _local5:Number = (_arg2.y - _local3.p.y);
return ((((_local4 * _local4) + (_local5 * _local5)) < D_SQUARED));
}
public function stop():void{
_stopped = true;
}
public function render():void{
var _local2:Note;
var _local1:uint = _notes.length;
while (_local1--) {
_local2 = (_notes[_local1] as Note);
_local2.render();
};
}
public function getVolume(_arg1:int):Number{
if (_t0 == -1){
return (0);
};
var _local2:int = (_arg1 - _t0);
var _local3:Number = 0;
if (_increaseVol){
if (_local2 >= 1000){
_increaseVol = false;
_v = 1;
} else {
_local3 = (_local2 / 1000);
_v = (_v0 + (_local3 * (1 - _v0)));
};
} else {
if (_local2 > 1500){
_local2 = (_local2 - 1500);
_local3 = (_local2 / 5000);
if (_local3 > 1){
_local3 = 1;
};
_v = (1 - _local3);
};
};
return (_v);
}
public function setVYOffset(_arg1:Number):void{
_offsetVY = _arg1;
}
public function dispose():void{
var _local2:Note;
var _local1:uint = _notes.length;
while (_local1--) {
_local2 = (_notes[_local1] as Note);
_local2.dispose();
};
_parent.removeChild(_container);
}
public function getConsecutivelyCollectedCount():uint{
return (_consecutiveCollected);
}
public function setOrigin(_arg1:Number, _arg2:Number):void{
_initialP.x = _arg1;
_initialP.y = _arg2;
}
public function collectNote(_arg1:uint):void{
var _local2:Note = (_notes[_arg1] as Note);
_local2.collect();
_collected++;
_consecutiveCollected++;
if ((_consecutiveCollected % Constants.SCORE_TEXT_EVERY) == 0){
_sfxPoints.play();
dispatchEvent(new Event(CONSECUTIVE_NOTE_BONUS_SMALL));
};
if (_consecutiveCollected >= Constants.NOTES_NEEDED_FOR_BONUS){
_sfxPoints.play();
dispatchEvent(new Event(CONSECUTIVE_NOTE_BONUS));
_consecutiveCollected = 0;
};
if (!_increaseVol){
_t0 = getTimer();
};
if (_v < 1){
_increaseVol = true;
_v0 = _v;
};
}
public function getCollectedCount():uint{
return (_collected);
}
public function getCount():uint{
return (_notes.length);
}
public function update():void{
var _local2:Note;
var _local1:uint = _notes.length;
while (_local1--) {
_local2 = (_notes[_local1] as Note);
_local2.update();
_local2.p.y = (_local2.p.y + _offsetVY);
if (((((!(_local2.collecting)) && (!(_local2.failedToCollect)))) && ((_local2.p.y > (Constants.HEIGHT + 100))))){
_local2.failedToCollect = true;
_consecutiveCollected = 0;
};
};
}
private function _onTimer(_arg1:TimerEvent):void{
if (((_active) && (!(_stopped)))){
_addNewNote();
};
}
private function _addNewNote():void{
var _local1:uint = (NUMBER_OF_NOTES - 1);
var _local2:Note = _notes[_local1];
while (_local1 > 0) {
_notes[_local1] = _notes[(_local1 - 1)];
_local1--;
};
_local2.p.x = (_initialP.x + (((2 * Math.random()) - 1) * Constants.HALF_UFO_WIDTH));
_local2.p.y = _initialP.y;
_local2.v.x = _initialV.x;
_local2.v.y = _initialV.y;
_local2.collecting = false;
_local2.failedToCollect = false;
_local2.clip.scaleX = (_local2.clip.scaleY = Note.BASE_SCALE);
_local2.clip.alpha = 1;
var _local3:uint = (2 + (10 * Math.floor((Math.random() * NUMBER_OF_COLOURS))));
_local2.clip.gotoAndStop(_local3);
_local2.clip.visible = true;
_notes[0] = _local2;
}
}
}//package com.kerb.sammy.hiphop.notes
Section 9
//Obstacle (com.kerb.sammy.hiphop.obstacles.Obstacle)
package com.kerb.sammy.hiphop.obstacles {
import flash.display.*;
import com.kerb.sammy.hiphop.*;
import flash.geom.*;
import com.kerb.sammy.hiphop.interfaces.*;
final class Obstacle implements IUpdateable, IRenderable, IDisposable {
private var _height:Number;// = 0
private var _width:Number;// = 0
private var _parent:Sprite;// = null
private var _row:uint;// = 0
private var _clip:Sprite;// = null
public var p:Point;
public var v:Point;
private var _symbol:String;// = null
private var _aabb:AABB;// = null
function Obstacle(_arg1:Sprite, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:uint){
p = new Point();
v = new Point();
super();
_parent = _arg1;
_row = _arg7;
_symbol = _arg2;
_clip = (Global.af.createDisplayObject(_arg2) as Sprite);
_clip.cacheAsBitmap = true;
p.x = (_clip.x = _arg3);
p.y = (_clip.y = _arg4);
v.x = _arg5;
v.y = _arg6;
_parent.addChild(_clip);
_aabb = new AABB();
}
public function getAABB():AABB{
_aabb.min.x = p.x;
_aabb.min.y = p.y;
_aabb.max.x = (p.x + _width);
_aabb.max.y = (p.y + _height);
return (_aabb);
}
public function setDimensions(_arg1:Point):void{
_width = _arg1.x;
_height = _arg1.y;
}
public function getWidth():Number{
return (_clip.width);
}
public function getSymbol():String{
return (_symbol);
}
public function render():void{
_clip.x = p.x;
_clip.y = p.y;
}
public function dispose():void{
_parent.removeChild(_clip);
}
public function update():void{
p.x = (p.x + v.x);
p.y = (p.y + v.y);
}
public function getRow():uint{
return (_row);
}
}
}//package com.kerb.sammy.hiphop.obstacles
Section 10
//Obstacles (com.kerb.sammy.hiphop.obstacles.Obstacles)
package com.kerb.sammy.hiphop.obstacles {
import flash.events.*;
import flash.display.*;
import uk.kerb.utils.logger.*;
import com.kerb.sammy.hiphop.*;
import flash.geom.*;
import com.kerb.sammy.hiphop.interfaces.*;
import flash.utils.*;
public final class Obstacles implements IUpdateable, IRenderable, IStopable, IDisposable {
private var _container:Sprite;// = null
private var _obstacles:Array;// = null
private var _timer:Timer;// = null
private var _parent:Sprite;// = null
private var _stopped:Boolean;// = false
private var _intersection:AABB;
private var _currentSpeed:Number;// = 0
private var _occupiedRows:Array;
private var _elapsed:Number;// = 0
private static const PERIOD:uint = 500;
private static const SYMBOLS:Array = ["SpeakerSquare", "SpeakerHorizontal", "SpeakerVertical", "SpeakerVertical"];
private static const MAX_OBSTACLES:uint = 3;
private static const NUMBER_OF_ROWS:uint = 4;
private static const DIMENSIONS:Array = [new Point(60, 60), new Point(120, 60), new Point(60, 120), new Point(60, 120)];
public function Obstacles(_arg1:Sprite){
_occupiedRows = [0, 0, 0, 0];
_intersection = new AABB();
super();
_parent = _arg1;
_container = new Sprite();
_parent.addChild(_container);
_timer = new Timer(PERIOD);
_timer.addEventListener(TimerEvent.TIMER, _onTimer);
_timer.start();
_obstacles = [];
}
public function setElapsed(_arg1:Number):void{
var _local3:Timer;
_elapsed = _arg1;
var _local2:Number = _getVXFromElapsed();
if (_local2 != _currentSpeed){
_currentSpeed = _local2;
if (!_stopped){
_timer.stop();
_local3 = new Timer(2500, 1);
_local3.addEventListener(TimerEvent.TIMER_COMPLETE, _restartMainTimer);
_local3.start();
};
};
}
private function _getRightmost():Number{
var _local4:Obstacle;
var _local5:AABB;
var _local1:uint = _obstacles.length;
var _local2:Number = 0;
var _local3:uint;
while (_local3 < _local1) {
_local4 = (_obstacles[_local3] as Obstacle);
_local5 = _local4.getAABB();
if (_local5.max.x > _local2){
_local2 = _local5.max.x;
};
_local3++;
};
return ((Math.max(_local2, Constants.WIDTH) + 10));
}
private function _addNewObstacle():void{
var _local1:uint;
_local1 = Math.floor((SYMBOLS.length * Math.random()));
var _local2:String = SYMBOLS[_local1];
var _local3:uint = Math.floor((NUMBER_OF_ROWS * Math.random()));
_incOccupiedRows(_local2, _local3);
if (_threeOrMoreRowsOccupied()){
_decOccupiedRows(_local2, _local3);
return;
};
var _local4:Number = ((70 * _local3) + 10);
var _local5:Number = _currentSpeed;
var _local6:Obstacle = new Obstacle(_container, _local2, _getRightmost(), _local4, _local5, 0, _local3);
_local6.setDimensions(DIMENSIONS[_local1]);
_obstacles.push(_local6);
}
public function stop():void{
_timer.stop();
_stopped = true;
}
private function _threeOrMoreRowsOccupied():Boolean{
var _local1:uint;
var _local2:uint;
while (_local2 < 4) {
if (_occupiedRows[_local2] > 0){
_local1++;
};
_local2++;
};
return ((_local1 >= 3));
}
private function _incOccupiedRows(_arg1:String, _arg2:uint):void{
var _local3 = _occupiedRows;
var _local4 = _arg2;
var _local5 = (_local3[_local4] + 1);
_local3[_local4] = _local5;
if (_arg2 < (NUMBER_OF_ROWS - 1)){
switch (_arg1){
case "SpeakerVertical":
_local3 = _occupiedRows;
_local4 = (_arg2 + 1);
_local5 = (_local3[_local4] + 1);
_local3[_local4] = _local5;
break;
default:
break;
};
};
}
public function update():void{
var _local3:Obstacle;
var _local1:Array = _obstacles.slice();
var _local2:uint = _local1.length;
while (_local2--) {
_local3 = (_local1[_local2] as Obstacle);
_local3.update();
if (_local3.p.x < (-(_local3.getWidth()) - 10)){
_decOccupiedRows(_local3.getSymbol(), _local3.getRow());
_obstacles[_local2].dispose();
_obstacles.splice(_local2, 1);
};
};
}
public function getCount():uint{
return (_obstacles.length);
}
public function render():void{
var _local2:Obstacle;
var _local1:uint = _obstacles.length;
while (_local1--) {
_local2 = (_obstacles[_local1] as Obstacle);
_local2.render();
};
}
private function _traceOccupiedRows():void{
var _local1 = "";
var _local2:uint;
while (_local2 < _occupiedRows.length) {
_local1 = (_local1 + "row ");
_local1 = (_local1 + String((_local2 + 1)));
_local1 = (_local1 + "=");
_local1 = (_local1 + String(_occupiedRows[_local2]));
if (_local2 < (_occupiedRows.length - 1)){
_local1 = (_local1 + ",");
};
_local2++;
};
Log.instance().info(_local1);
}
private function _getVXFromElapsed():Number{
var _local1:Number = (-12 - (16 * _elapsed));
_local1 = Math.round(_local1);
return ((_local1 / 4));
}
public function getAABB(_arg1:uint):AABB{
if ((((_arg1 >= 0)) && ((_arg1 < _obstacles.length)))){
return (_obstacles[_arg1].getAABB());
};
return (null);
}
public function dispose():void{
var _local2:Obstacle;
if (!_stopped){
stop();
};
var _local1:uint = _obstacles.length;
while (_local1--) {
_local2 = (_obstacles[_local1] as Obstacle);
_local2.dispose();
};
}
private function _onTimer(_arg1:TimerEvent):void{
var _local2:Number = Math.min(1, (0.5 + (0.5 * _elapsed)));
if (Math.random() < _local2){
if (_obstacles.length < MAX_OBSTACLES){
_addNewObstacle();
};
};
}
private function _restartMainTimer(_arg1:TimerEvent):void{
_timer.start();
}
private function _decOccupiedRows(_arg1:String, _arg2:uint):void{
var _local3 = _occupiedRows;
var _local4 = _arg2;
var _local5 = (_local3[_local4] - 1);
_local3[_local4] = _local5;
if (_arg2 < (NUMBER_OF_ROWS - 1)){
switch (_arg1){
case "SpeakerVertical":
_local3 = _occupiedRows;
_local4 = (_arg2 + 1);
_local5 = (_local3[_local4] - 1);
_local3[_local4] = _local5;
break;
default:
break;
};
};
}
}
}//package com.kerb.sammy.hiphop.obstacles
Section 11
//IScoreSystem (com.kerb.sammy.hiphop.particles.IScoreSystem)
package com.kerb.sammy.hiphop.particles {
import flash.display.*;
import com.kerb.sammy.hiphop.interfaces.*;
public interface IScoreSystem extends IUpdateable, IRenderable, IDisposable, IContainer, IVelocityOffset {
function getBuffer():BitmapData;
}
}//package com.kerb.sammy.hiphop.particles
Section 12
//IThrustSystem (com.kerb.sammy.hiphop.particles.IThrustSystem)
package com.kerb.sammy.hiphop.particles {
import flash.display.*;
import com.kerb.sammy.hiphop.interfaces.*;
public interface IThrustSystem extends IUpdateable, IRenderable, IDisposable, IContainer {
function setRate(_arg1:uint):void;
function getBuffer():BitmapData;
}
}//package com.kerb.sammy.hiphop.particles
Section 13
//Particle (com.kerb.sammy.hiphop.particles.Particle)
package com.kerb.sammy.hiphop.particles {
import flash.geom.*;
import flash.utils.*;
final class Particle {
public var p:Point;
public var index:uint;// = 0
public var t0:uint;// = 0
public var e:Number;// = 1
public var v:Point;
function Particle(_arg1:uint, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0){
p = new Point();
v = new Point();
super();
this.index = _arg1;
p.x = _arg2;
p.y = _arg3;
v.x = _arg4;
v.y = _arg5;
t0 = getTimer();
}
}
}//package com.kerb.sammy.hiphop.particles
Section 14
//ParticleSystemFactory (com.kerb.sammy.hiphop.particles.ParticleSystemFactory)
package com.kerb.sammy.hiphop.particles {
public final class ParticleSystemFactory {
public function ParticleSystemFactory(){
throw (new Error("class is static"));
}
public static function createScore(_arg1:uint, _arg2:uint):IScoreSystem{
return (new ScoreSystem(_arg1, _arg2));
}
}
}//package com.kerb.sammy.hiphop.particles
Section 15
//ScoreSystem (com.kerb.sammy.hiphop.particles.ScoreSystem)
package com.kerb.sammy.hiphop.particles {
import flash.events.*;
import flash.display.*;
import com.kerb.sammy.hiphop.*;
import flash.geom.*;
import com.kerb.sammy.hiphop.particles.*;
import flash.utils.*;
import flash.filters.*;
final class ScoreSystem implements IScoreSystem {
private var _timerInvokations:uint;// = 0
private var _blur:BlurFilter;// = null
private var _timer:Timer;// = null
private var _stopped:Boolean;// = false
private var _buffer:BitmapData;// = null
private var _parts:Array;// = null
private var _initialP:Point;
private var _initialV:Point;
private var _offsetVY:Number;// = 0
private static const PERIOD:uint = 1000;
private static const ORIGIN:Point = new Point();
private static const BLUR_QUALITY:uint = 2;
private static const NUMBER_OF_LINES:uint = 5;
private static const BLUR_STRENGTH:uint = 4;
private static const BACKGROUND_COLOUR:uint = 0xFFFFFF;
function ScoreSystem(_arg1:uint, _arg2:uint){
_initialP = new Point();
_initialV = new Point();
super();
_buffer = new BitmapData(_arg1, _arg2, true, BACKGROUND_COLOUR);
_blur = new BlurFilter(BLUR_STRENGTH, BLUR_STRENGTH, BLUR_QUALITY);
_parts = [];
_timer = new Timer(PERIOD);
_timer.addEventListener(TimerEvent.TIMER, _onTimer);
_timer.start();
}
public function update():void{
var _local7:uint;
var _local1:uint = getTimer();
var _local2:Particle;
var _local3:uint;
var _local4:Number = _getXCoord(0);
var _local5:Number = _getXCoord((NUMBER_OF_LINES - 1));
if (!_stopped){
_local7 = 0;
while (_local7 < NUMBER_OF_LINES) {
_local2 = new Particle(_parts.length);
_initParticle(_local2, _getXCoord(_local7));
_parts.push(_local2);
_local7++;
};
};
var _local6:Array = _parts.slice();
_local3 = _local6.length;
while (_local3--) {
_local2 = (_local6[_local3] as Particle);
_local2.p.y = (_local2.p.y + (_local2.v.y + _offsetVY));
if (_local2.p.y > Constants.HEIGHT){
_parts.splice(_local3, 1);
};
};
}
public function stop():void{
_stopped = true;
}
private function _getXCoord(_arg1:uint):Number{
return (((15.5 * _arg1) - Constants.HALF_UFO_WIDTH));
}
private function _initParticle(_arg1:Particle, _arg2:Number, _arg3:Number=0):void{
_arg1.p.x = (_initialP.x + _arg2);
_arg1.p.y = (_initialP.y + _arg3);
_arg1.v.x = _initialV.x;
_arg1.v.y = _initialV.y;
_arg1.t0 = getTimer();
_arg1.e = 1;
}
public function setVYOffset(_arg1:Number):void{
_offsetVY = _arg1;
}
public function getCount():uint{
return (_parts.length);
}
public function render():void{
var _local2:Particle;
var _local3:Number;
var _local4:uint;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:int;
_buffer.fillRect(_buffer.rect, BACKGROUND_COLOUR);
var _local1:uint = _parts.length;
while (_local1--) {
_local2 = (_parts[_local1] as Particle);
_local3 = (1 * 0xFF);
_local4 = (_local3 << 24);
_local5 = 0x333333;
_local6 = _local2.p.x;
_local7 = _local2.p.y;
_local8 = (_local5 | _local4);
_drawPoint(_local6, _local7, _local8);
};
_buffer.applyFilter(_buffer, _buffer.rect, ORIGIN, _blur);
}
public function dispose():void{
}
private function _onTimer(_arg1:TimerEvent):void{
if (_stopped){
return;
};
_addParticleRow(0);
if ((++_timerInvokations % 3) == 0){
_addParticleRow(10);
};
}
public function setOrigin(_arg1:Number, _arg2:Number):void{
_initialP.x = _arg1;
_initialP.y = _arg2;
}
private function _drawPoint(_arg1:Number, _arg2:Number, _arg3:int):void{
if ((_arg1 - 1) >= 0){
_buffer.setPixel32((_arg1 - 1), _arg2, _arg3);
};
if ((_arg1 + 1) < _buffer.width){
_buffer.setPixel32((_arg1 + 1), _arg2, _arg3);
};
if ((_arg2 - 1) >= 0){
_buffer.setPixel32(_arg1, (_arg2 - 1), _arg3);
};
if ((_arg2 + 1) < _buffer.height){
_buffer.setPixel32(_arg1, (_arg2 + 1), _arg3);
};
_buffer.setPixel32(_arg1, _arg2, _arg3);
}
private function _addParticleRow(_arg1:Number):void{
var _local5:Particle;
var _local2:Number = _getXCoord(0);
var _local3:Number = _getXCoord((NUMBER_OF_LINES - 1));
var _local4:Number = _local2;
while (_local4 < _local3) {
_local5 = new Particle(_parts.length);
_initParticle(_local5, _local4, _arg1);
_parts.push(_local5);
_local4 = (_local4 + 4);
};
}
public function getBuffer():BitmapData{
return (_buffer);
}
public function setInitialVelocity(_arg1:Number, _arg2:Number):void{
_initialV.x = _arg1;
_initialV.y = _arg2;
}
}
}//package com.kerb.sammy.hiphop.particles
Section 16
//AABB (com.kerb.sammy.hiphop.AABB)
package com.kerb.sammy.hiphop {
import flash.display.*;
import flash.geom.*;
public final class AABB {
public var min:Point;
public var max:Point;
public function AABB(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){
min = new Point();
max = new Point();
super();
min.x = _arg1;
min.y = _arg3;
max.x = _arg2;
max.y = _arg4;
}
public function draw(_arg1:Graphics):void{
_arg1.beginFill(0xFF0000, 0.5);
_arg1.drawRect(min.x, min.y, (max.x - min.x), (max.y - min.y));
_arg1.endFill();
}
public function toString():String{
var _local1 = "";
_local1 = (_local1 + ("xMin=" + String(min.x)));
_local1 = (_local1 + ",");
_local1 = (_local1 + ("xMax=" + String(max.x)));
_local1 = (_local1 + ",");
_local1 = (_local1 + ("yMin=" + String(min.y)));
_local1 = (_local1 + ",");
_local1 = (_local1 + ("yMax=" + String(max.y)));
return (_local1);
}
public static function intersects(_arg1:AABB, _arg2:AABB, _arg3:AABB=null):Boolean{
if (_arg1.max.x < _arg2.min.x){
return (false);
};
if (_arg1.min.x > _arg2.max.x){
return (false);
};
if (_arg1.max.y < _arg2.min.y){
return (false);
};
if (_arg1.min.y > _arg2.max.y){
return (false);
};
if (_arg3 != null){
_arg3.min.x = Math.max(_arg1.min.x, _arg2.min.x);
_arg3.max.x = Math.min(_arg1.max.x, _arg2.max.x);
_arg3.min.y = Math.max(_arg1.min.y, _arg2.min.y);
_arg3.max.y = Math.min(_arg1.max.y, _arg2.max.y);
};
return (true);
}
}
}//package com.kerb.sammy.hiphop
Section 17
//Background (com.kerb.sammy.hiphop.Background)
package com.kerb.sammy.hiphop {
import flash.display.*;
import com.kerb.sammy.hiphop.interfaces.*;
public final class Background implements IUpdateable, IDisposable {
private var _resuming:Boolean;// = false
private var _sky:Sprite;// = null
private var _speed:Number;// = 1.5
private var _parent:Sprite;// = null
private var _halting:Boolean;// = false
private var _frontA:Sprite;// = null
private var _frontB:Sprite;// = null
private var _rearA:Sprite;// = null
private var _rearB:Sprite;// = null
private static const REAR_TILE_WIDTH:uint = 565;
private static const SPEED:Number = 1.5;
private static const FRONT_TILE_WIDTH:uint = 631;
public function Background(_arg1:Sprite){
_parent = _arg1;
_sky = (Global.af.createDisplayObject("BackgroundSky") as Sprite);
_sky.cacheAsBitmap = true;
_frontA = (Global.af.createDisplayObject("FrontTile") as Sprite);
_frontB = (Global.af.createDisplayObject("FrontTile") as Sprite);
_frontA.x = 0;
_frontA.y = 65;
_frontB.x = FRONT_TILE_WIDTH;
_frontB.y = 65;
_frontA.cacheAsBitmap = true;
_frontB.cacheAsBitmap = true;
_rearA = (Global.af.createDisplayObject("RearTile") as Sprite);
_rearB = (Global.af.createDisplayObject("RearTile") as Sprite);
_rearA.x = 0;
_rearA.y = 0;
_rearB.x = REAR_TILE_WIDTH;
_rearB.y = 0;
_rearA.cacheAsBitmap = true;
_rearB.cacheAsBitmap = true;
_parent.addChild(_sky);
_parent.addChild(_rearA);
_parent.addChild(_rearB);
_parent.addChild(_frontA);
_parent.addChild(_frontB);
}
public function halt():void{
_halting = true;
_resuming = false;
}
public function dispose():void{
_parent.removeChild(_sky);
_parent.removeChild(_rearA);
_parent.removeChild(_rearB);
_parent.removeChild(_frontA);
_parent.removeChild(_frontB);
}
public function resume():void{
_resuming = true;
_halting = false;
}
public function update():void{
if (_halting){
_speed = (_speed - 0.1);
if (_speed < 0){
_speed = 0;
_halting = false;
};
};
if (_resuming){
_speed = (_speed + 0.1);
if (_speed > SPEED){
_speed = SPEED;
_resuming = false;
};
};
_frontA.x = (_frontA.x - _speed);
_frontB.x = (_frontB.x - _speed);
if (_frontA.x < -(FRONT_TILE_WIDTH)){
_frontA.x = (_frontB.x + FRONT_TILE_WIDTH);
} else {
if (_frontB.x < -(FRONT_TILE_WIDTH)){
_frontB.x = (_frontA.x + FRONT_TILE_WIDTH);
};
};
_rearA.x = (_rearA.x - (_speed / 2));
_rearB.x = (_rearB.x - (_speed / 2));
if (_rearA.x < -(REAR_TILE_WIDTH)){
_rearA.x = (_rearB.x + REAR_TILE_WIDTH);
} else {
if (_rearB.x < -(REAR_TILE_WIDTH)){
_rearB.x = (_rearA.x + REAR_TILE_WIDTH);
};
};
}
}
}//package com.kerb.sammy.hiphop
Section 18
//Constants (com.kerb.sammy.hiphop.Constants)
package com.kerb.sammy.hiphop {
public final class Constants {
public static const HALF_UFO_WIDTH:Number = 30;
public static const MUSIC_CREDIT_TRACKING:String = "http://watches.whodidit.co.uk/watch84.swf";
public static const GAME_ID:uint = 3;
public static const PARTICLES:uint = 250;
public static const MEMECOUNTER_HIGHSCORE_TRACKING:int = 622;
public static const GAME_MOVE_ON_UP:String = "move_on_up.php";
public static const MEMECOUNTER_CAMPAIGN_ID:int = 377;
public static const MEMECOUNTER_NEOLICIOUS_TRACKING:int = 474;
public static const GAME_GOTH:String = "bat_out_of_hell.php";
public static const NOTES_NEEDED_TO_WIN:uint = 270;
public static const WIDTH:uint = 550;
public static const WHODIDIT_TRACKING:String = "http://watches.whodidit.co.uk/watch92.swf";
public static const INITIAL_FPS:uint = 40;
public static const SOUNDTRACK_VOLUME_FACTOR:Number = 0.7;
public static const HALF_UFO_HEIGHT:Number = 17;
public static const GRAVITY:Number = 0.175;
public static const HEIGHT:uint = 400;
public static const DRAW_AABBS:Boolean = false;
public static const GAME_PUP_IDOL:String = "pup_idol.php";
public static const FALLING_VELOCITY:Number = 5;
public static const SKIP_COLLISION_DETECTION:Boolean = false;
public static const NOTES_NEEDED_FOR_BONUS:uint = 30;
public static const PARAM_NAME_SCORE:String = "score";
public static const BASE_PATH:String = "http://www.sammysgamebox.com";
public static const PARAM_NAME_GAME:String = "gameid";
public static const SCORE_TEXT_EVERY:uint = 5;
public static const GAME_LENGTH:uint = 180000;
public static const BASE_FPS:uint = 34;
public static const AD_NAUSEUM:uint = 99999;
public static const GAME_KILLAWATT:String = "killawatt.php";
public static const NEOLICIOUS_LINK:String = "http://neolicious.com/index.htm#artist_1";
public static const SHOW_GET_READY_PERIOD:uint = 1500;
public static const SOUNDTRACK_FADE_OUT_PERIOD:uint = 250;
public static const MEMECOUNTER_PLAYAGAIN_TRACKING:int = 623;
public function Constants(){
throw (new Error("class is static"));
}
}
}//package com.kerb.sammy.hiphop
Section 19
//Game (com.kerb.sammy.hiphop.Game)
package com.kerb.sammy.hiphop {
import flash.events.*;
import flash.display.*;
import uk.kerb.utils.sound.*;
import com.kerb.sammy.hiphop.*;
import flash.geom.*;
import com.kerb.sammy.hiphop.particles.*;
import com.kerb.sammy.hiphop.interfaces.*;
import com.kerb.sammy.hiphop.notes.*;
import com.kerb.sammy.hiphop.obstacles.*;
import flash.utils.*;
import flash.ui.*;
final class Game extends Sprite implements IDisposable {
private var _scorePopupTexts:ScorePopupTexts;// = null
private var _score:uint;// = 0
private var _ts:IThrustSystem;// = null
private var _soundtrack:Soundtrack;// = null
private var _ufo:UnidentifiedFlyingObject;// = null
private var _notes:Notes;// = null
private var _obstacles:Obstacles;// = null
private var _timer:Timer;// = null
private var _noteProg:NoteProgress;// = null
private var _sammy:Sammy;// = null
private var _skd:Boolean;// = false
private var _lad:Boolean;// = false
private var _background:Background;// = null
private var _rad:Boolean;// = false
private var _scorebox:ScoreBox;// = null
private var _t0:uint;// = 0
private var _gameOver:Boolean;// = false
private var _surface:Sprite;// = null
private var _frames:uint;// = 0
private var _ss:IScoreSystem;// = null
public static const EVENT_GAME_LOST:String = "onGameLost";
public static const EVENT_GAME_WON:String = "onGameWon";
function Game(_arg1:Stage){
_background = new Background(this);
_noteProg = new NoteProgress(this);
_scorebox = new ScoreBox(this);
_obstacles = new Obstacles(this);
_ss = ParticleSystemFactory.createScore(Constants.WIDTH, Constants.HEIGHT);
addChild(new Bitmap(_ss.getBuffer()));
addEventListener(Event.ENTER_FRAME, _update);
_timer = new Timer(1000);
_timer.addEventListener(TimerEvent.TIMER, _onTimer);
_timer.start();
_arg1.addEventListener(KeyboardEvent.KEY_UP, _onKeyUp);
_arg1.addEventListener(KeyboardEvent.KEY_DOWN, _onKeyDown);
_sammy = new Sammy(this);
_sammy.walk((Constants.WIDTH / 2), 315);
_notes = new Notes(this);
_notes.addEventListener(Notes.CONSECUTIVE_NOTE_BONUS, _onConsecutiveNoteBonus);
_notes.addEventListener(Notes.CONSECUTIVE_NOTE_BONUS_SMALL, _onConsecutiveNoteBonusSmall);
_ufo = new UnidentifiedFlyingObject(this, (Constants.WIDTH / 2), (Constants.HEIGHT / 4));
_ss.setOrigin(_ufo.getX(), _ufo.getY());
_scorePopupTexts = new ScorePopupTexts(this);
_surface = new Sprite();
addChild(_surface);
_t0 = getTimer();
_soundtrack = new Soundtrack(this);
var _local2:ExtendedSound = Global.af.createSound("SFXCountdown");
_local2.play();
}
private function _drawAABB():void{
_surface.graphics.clear();
var _local1:AABB;
_ufo.getAABB().draw(_surface.graphics);
var _local2:uint = _obstacles.getCount();
var _local3:uint;
while (_local3 < _local2) {
_obstacles.getAABB(_local3).draw(_surface.graphics);
_local3++;
};
}
private function _onBreakdanceComplete(_arg1:Event):void{
_sammy.removeEventListener(Sammy.EVENT_BREAKDANCE_COMPLETE, _onBreakdanceComplete);
_background.resume();
}
private function _onExplosionComplete(_arg1:Event):void{
_ufo.removeEventListener("ExplosionComplete", _onExplosionComplete);
dispatchEvent(new Event(EVENT_GAME_LOST));
}
public function dispose():void{
_background.dispose();
_noteProg.dispose();
_scorebox.dispose();
_obstacles.dispose();
_ss.dispose();
_sammy.dispose();
_notes.removeEventListener(Notes.CONSECUTIVE_NOTE_BONUS, _onConsecutiveNoteBonus);
_notes.removeEventListener(Notes.CONSECUTIVE_NOTE_BONUS_SMALL, _onConsecutiveNoteBonusSmall);
_notes.dispose();
_ufo.dispose();
_scorePopupTexts.dispose();
_soundtrack.dispose();
removeChild(_surface);
_timer.stop();
_timer = null;
}
private function _onConsecutiveNoteBonusSmall(_arg1:Event):void{
var _local2:uint = _notes.getConsecutivelyCollectedCount();
var _local3:uint;
if (_local2 < Constants.NOTES_NEEDED_FOR_BONUS){
_local3 = ((100 * _local2) / Constants.SCORE_TEXT_EVERY);
} else {
_local3 = 1000;
};
_score = (_score + _local3);
_scorePopupTexts.addText(_local3, _sammy.getX(), 290);
}
private function _setGameOver():void{
_gameOver = true;
if (_ts != null){
_ts.stop();
};
if (_ss != null){
_ss.stop();
};
_notes.stop();
_obstacles.stop();
}
public function halt():void{
visible = false;
removeEventListener(Event.ENTER_FRAME, _update);
_soundtrack.fadeOut();
stage.removeEventListener(KeyboardEvent.KEY_UP, _onKeyUp);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, _onKeyDown);
}
private function _onKeyDown(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case Keyboard.SPACE:
_skd = true;
break;
case Keyboard.LEFT:
_lad = true;
_rad = false;
break;
case Keyboard.RIGHT:
_rad = true;
_lad = false;
break;
default:
break;
};
}
private function _onConsecutiveNoteBonus(_arg1:Event):void{
if (!_sammy.isDancing()){
_sammy.addEventListener(Sammy.EVENT_BREAKDANCE_COMPLETE, _onBreakdanceComplete);
_sammy.dance();
_background.halt();
};
}
public function getScore():uint{
return (_score);
}
private function _onTimer(_arg1:TimerEvent):void{
if (stage.frameRate > Constants.BASE_FPS){
if (_frames >= Constants.BASE_FPS){
stage.frameRate = (stage.frameRate - 2);
};
};
_frames = 0;
}
private function _update(_arg1:Event):void{
var _local9:AABB;
var _local2:uint = getTimer();
var _local3:uint = (getTimer() - _t0);
var _local4:uint = _notes.getCollectedCount();
if (!_gameOver){
if (_local4 >= Constants.NOTES_NEEDED_TO_WIN){
_setGameOver();
dispatchEvent(new Event(EVENT_GAME_WON));
} else {
if (_local3 >= Constants.GAME_LENGTH){
_setGameOver();
dispatchEvent(new Event(EVENT_GAME_LOST));
};
};
};
var _local5:uint;
var _local6:uint;
var _local7:Boolean = ((_lad) || (_rad));
_notes.setActive(_local7);
_ufo.setLeftThrust(_lad);
_ufo.setRightThrust(_rad);
_ufo.setThrust(_skd);
_ufo.setRedLight(!(_local7));
_ufo.update();
_ufo.render();
if (_background != null){
_background.update();
};
_notes.setOrigin(_ufo.getX(), _ufo.getY());
_notes.setInitialVelocity(0, Constants.FALLING_VELOCITY);
_notes.setVYOffset(_ufo.getVY());
_soundtrack.setVolume(_notes.getVolume(_local2));
_notes.update();
_notes.render();
if (_ts != null){
_ts.setRate((_skd) ? 8 : 0);
_ts.setOrigin(_ufo.getX(), _ufo.getY());
_ts.setInitialVelocity(0, (3 + _ufo.getVY()));
_ts.update();
_ts.render();
};
if (_ss != null){
_ss.setOrigin(_ufo.getX(), _ufo.getY());
_ss.setInitialVelocity(0, Constants.FALLING_VELOCITY);
_ss.setVYOffset(_ufo.getVY());
_ss.update();
_ss.render();
};
if (_obstacles != null){
_obstacles.setElapsed((_local3 / Constants.GAME_LENGTH));
_obstacles.update();
_obstacles.render();
};
if (((((((!(Constants.SKIP_COLLISION_DETECTION)) && (!(_ufo.exploding)))) && (!((_obstacles == null))))) && (!(_gameOver)))){
_local5 = _obstacles.getCount();
_local9 = _ufo.getAABB();
_local6 = 0;
while (_local6 < _local5) {
if (AABB.intersects(_local9, _obstacles.getAABB(_local6))){
_setGameOver();
_ufo.addEventListener(UnidentifiedFlyingObject.EVENT_EXPLOSION_COMPLETE, _onExplosionComplete);
_ufo.explode();
};
_local6++;
};
};
_local5 = _notes.getCount();
var _local8:Point = _sammy.getHeadphonesPos();
_local6 = 0;
while (_local6 < _local5) {
if (_notes.isCloseTo(_local6, _local8)){
_notes.collectNote(_local6);
};
_local6++;
};
_noteProg.setPercentage(Math.round(((100 * _local4) / Constants.NOTES_NEEDED_TO_WIN)));
_scorebox.elapsed = _local3;
_scorebox.score = _score;
_scorebox.update();
_scorePopupTexts.update();
if (Constants.DRAW_AABBS){
_drawAABB();
};
_frames++;
}
private function _onKeyUp(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case Keyboard.SPACE:
_skd = false;
break;
case Keyboard.LEFT:
_lad = false;
break;
case Keyboard.RIGHT:
_rad = false;
break;
default:
break;
};
}
}
}//package com.kerb.sammy.hiphop
Section 20
//Global (com.kerb.sammy.hiphop.Global)
package com.kerb.sammy.hiphop {
import uk.kerb.utils.*;
public final class Global {
public static var af:AssetFactory = null;
public function Global(){
throw (new Error("class is static"));
}
}
}//package com.kerb.sammy.hiphop
Section 21
//Main (com.kerb.sammy.hiphop.Main)
package com.kerb.sammy.hiphop {
import flash.events.*;
import flash.display.*;
import uk.kerb.utils.sound.*;
import uk.kerb.utils.logger.*;
import flash.utils.*;
import com.memecounter.*;
import uk.kerb.utils.*;
import flash.net.*;
import flash.ui.*;
public final class Main extends Sprite {
private var _gameWon:MovieClip;// = null
private var _foo:Function;// = null
private var _sfxLost:ExtendedSound;// = null
private var _gameLost:MovieClip;// = null
private var _mainMenu:MovieClip;// = null
private var _goButton:MovieClip;// = null
private var _sfxButton:ExtendedSound;// = null
private var _isMuted:Boolean;// = false
private var _playButton:MovieClip;// = null
private var _submitScoreButton:MovieClip;// = null
private var _getReady:MovieClip;// = null
private var _game:Game;// = null
private var _lostPlayAgainButton:MovieClip;// = null
private var _instr:MovieClip;// = null
private var _sfxWon:ExtendedSound;// = null
private var _mute:MovieClip;// = null
public function Main(_arg1:Class){
Global.af = new AssetFactory();
Global.af.addEventListener(AssetFactory.EVENT_ASSET_FACTORY_READY, _onAssetFactoryReady);
Global.af.initialize(_arg1);
}
private function _onPlayWonSFX(_arg1:TimerEvent):void{
_sfxWon.play();
}
private function _setupWonLostScreen(_arg1:MovieClip):void{
var _local2:MovieClip;
var _local3:MovieClip;
var _local4:MovieClip;
var _local5:MovieClip;
var _local6:MovieClip;
var _local7:SimpleButton;
var _local8:SimpleButton;
if (_arg1 != null){
if (_arg1.playAgain_btn != null){
_local7 = (_arg1.playAgain_btn as SimpleButton);
_local7.addEventListener(MouseEvent.CLICK, _onPlayAgainButtonClicked);
_setupKboardEventL(_onPlayAgainButtonClicked);
};
if (_arg1.highscore_btn != null){
_local8 = (_arg1.highscore_btn as SimpleButton);
_local8.addEventListener(MouseEvent.CLICK, _onViewHighScoresButtonClicked);
};
if (_arg1.score_txt != null){
_arg1.score_txt.text = String(_game.getScore());
};
_local2 = _arg1.thumbs_mc;
_local3 = (_local2.pupidol_mc as MovieClip);
_local3.buttonMode = true;
_local3.addEventListener(MouseEvent.CLICK, _onOpenPupIdol);
_local4 = (_local2.moveonup_mc as MovieClip);
_local4.buttonMode = true;
_local4.addEventListener(MouseEvent.CLICK, _onOpenMoveOnUp);
_local5 = (_local2.killawatt_mc as MovieClip);
_local5.buttonMode = true;
_local5.addEventListener(MouseEvent.CLICK, _onOpenKillawatt);
_local6 = (_local2.batoutofhell_mc as MovieClip);
_local6.buttonMode = true;
_local6.addEventListener(MouseEvent.CLICK, _onOpenGoth);
};
}
private function _onOpenKillawatt(_arg1:MouseEvent):void{
Tracker.kvClick(494);
_onOpenOtherGame(Constants.GAME_KILLAWATT);
}
private function _onPlayLostSFX(_arg1:TimerEvent):void{
_sfxLost.play();
}
private function _onPlayAgainButtonClicked(_arg1:MouseEvent):void{
_onStartAnotherGame();
Tracker.kvClick(Constants.MEMECOUNTER_PLAYAGAIN_TRACKING);
_sfxButton.play();
}
private function _onOpenOtherGame(_arg1:String):void{
var _local4:String;
var _local2:String = Constants.BASE_PATH;
if (loaderInfo.parameters.basepath){
_local2 = loaderInfo.parameters.basepath;
};
if (_local2.charAt((_local2.length - 1)) != "/"){
_local2 = (_local2 + "/");
};
var _local3:String = _local2;
_local3 = (_local3 + _arg1);
_local4 = _getHostFromBasePath(_local2);
var _local5:String = ((loaderInfo.url.indexOf(_local4) >= 0)) ? "_self" : "_blank";
var _local6:URLRequest = new URLRequest(_local3);
navigateToURL(_local6, _local5);
}
private function _submitScore():void{
var request:URLRequest = new URLRequest(_getSubmitURL());
var loader:URLLoader = new URLLoader();
try {
loader.load(request);
} catch(e:SecurityError) {
};
}
private function _onStartNewGame(_arg1:TimerEvent):void{
removeChild(_getReady);
_getReady = null;
_game = new Game(stage);
_game.addEventListener(Game.EVENT_GAME_LOST, _onGameLost);
_game.addEventListener(Game.EVENT_GAME_WON, _onGameWon);
addChild(_game);
_muteButtonToTop();
stage.frameRate = Constants.INITIAL_FPS;
}
private function _setupPlayButton(_arg1:Event):void{
if (((!((_mainMenu == null))) && (!((_mainMenu.button_mc == null))))){
_mainMenu.removeEventListener(Event.ENTER_FRAME, _setupPlayButton);
_playButton = (_mainMenu.button_mc as MovieClip);
_playButton.addEventListener("ButtonReady", _onPlayButtonReady);
};
}
private function _onShowGetReady(_arg1:Event):void{
removeChild(_instr);
_instr = null;
_doShowGetReady();
}
private function _onGoButtonReady(_arg1:Event):void{
_goButton.removeEventListener("ButtonReady", _onGoButtonReady);
var _local2:MovieClip = (_goButton.button_mc as MovieClip);
_local2.buttonMode = true;
_local2.useHandCursor = true;
_local2.addEventListener(MouseEvent.CLICK, _onGoButtonClicked);
_setupKboardEventL(_onGoButtonClicked);
}
private function _onGoButtonClicked(_arg1:MouseEvent):void{
_goButton.addEventListener("ButtonGoneAway", _onShowGetReady);
_goButton.play();
_sfxButton.play();
}
private function _muteButtonToTop():void{
setChildIndex(_mute, (numChildren - 1));
}
private function _onViewHighScoresButtonClicked(_arg1:MouseEvent):void{
_submitScoreAndNavigateToHighScoreTable();
Tracker.kvClick(Constants.MEMECOUNTER_HIGHSCORE_TRACKING);
_sfxButton.play();
}
private function _setupKboardEventL(_arg1:Function):void{
_foo = _arg1;
stage.addEventListener(KeyboardEvent.KEY_DOWN, _removeKboardEventL);
}
private function _getBasePath():String{
var _local1:String = Constants.BASE_PATH;
if (loaderInfo.parameters.basepath){
_local1 = loaderInfo.parameters.basepath;
};
if (_local1.charAt((_local1.length - 1)) != "/"){
_local1 = (_local1 + "/");
};
return (_local1);
}
private function _setupLostScreen(_arg1:Event):void{
_gameLost.removeEventListener(Event.ENTER_FRAME, _setupLostScreen);
if (_gameLost.mode_txt){
_gameLost.mode_txt.text = "GAME OVER!";
};
_setupWonLostScreen(_gameLost);
}
private function _setupWonScreen(_arg1:Event):void{
_gameWon.removeEventListener(Event.ENTER_FRAME, _setupWonScreen);
if (_gameWon.mode_txt){
_gameWon.mode_txt.text = "GAME COMPLETE!";
};
_setupWonLostScreen(_gameWon);
}
private function _doShowGetReady():void{
_getReady = (Global.af.createDisplayObject("GetReady") as MovieClip);
addChild(_getReady);
_muteButtonToTop();
var _local1:Timer = new Timer(Constants.SHOW_GET_READY_PERIOD, 1);
_local1.addEventListener(TimerEvent.TIMER_COMPLETE, _onStartNewGame);
_local1.start();
}
private function _setupGoButton(_arg1:Event):void{
if (((!((_instr == null))) && (!((_instr.button_mc == null))))){
_instr.removeEventListener(Event.ENTER_FRAME, _setupGoButton);
_goButton = (_instr.button_mc as MovieClip);
_goButton.addEventListener("ButtonReady", _onGoButtonReady);
};
}
private function _onMuteToggled(_arg1:MouseEvent):void{
_isMuted = !(_isMuted);
_sfxButton.play();
if (_isMuted){
SoundManager.getInstance().mute();
} else {
SoundManager.getInstance().unmute();
};
if (_mute.mute_mc != null){
_mute.mute_mc.gotoAndStop((_isMuted) ? 2 : 1);
};
}
private function _onGameLost(_arg1:Event):void{
stage.frameRate = Constants.BASE_FPS;
_game.halt();
var _local2:Timer = new Timer(Constants.SOUNDTRACK_FADE_OUT_PERIOD, 1);
_local2.addEventListener(TimerEvent.TIMER_COMPLETE, _onPlayLostSFX);
_local2.start();
_gameLost = (Global.af.createDisplayObject("GameWonLost") as MovieClip);
addChild(_gameLost);
_muteButtonToTop();
_gameLost.addEventListener(Event.ENTER_FRAME, _setupLostScreen);
_submitScore();
}
private function _onPlayButtonReady(_arg1:Event):void{
_playButton.removeEventListener("ButtonReady", _onPlayButtonReady);
var _local2:MovieClip = (_playButton.button_mc as MovieClip);
_local2.buttonMode = true;
_local2.useHandCursor = true;
_local2.addEventListener(MouseEvent.CLICK, _onPlayButtonClicked);
_setupKboardEventL(_onPlayButtonClicked);
}
private function _onShowInstructions(_arg1:Event):void{
removeChild(_mainMenu);
_mainMenu = null;
_instr = (Global.af.createDisplayObject("Instructions") as MovieClip);
addChild(_instr);
_muteButtonToTop();
_instr.addEventListener(Event.ENTER_FRAME, _setupGoButton);
}
private function _onPlayButtonClicked(_arg1:MouseEvent):void{
_playButton.addEventListener("ButtonGoneAway", _onShowInstructions);
_playButton.play();
_sfxButton.play();
}
private function _onOpenGoth(_arg1:MouseEvent):void{
Tracker.kvClick(492);
_onOpenOtherGame(Constants.GAME_GOTH);
}
private function _onGameWon(_arg1:Event):void{
stage.frameRate = Constants.BASE_FPS;
_game.halt();
var _local2:Timer = new Timer(Constants.SOUNDTRACK_FADE_OUT_PERIOD, 1);
_local2.addEventListener(TimerEvent.TIMER_COMPLETE, _onPlayWonSFX);
_local2.start();
_gameWon = (Global.af.createDisplayObject("GameWonLost") as MovieClip);
addChild(_gameWon);
_muteButtonToTop();
_gameWon.addEventListener(Event.ENTER_FRAME, _setupWonScreen);
_submitScore();
}
private function _onOpenPupIdol(_arg1:MouseEvent):void{
Tracker.kvClick(495);
_onOpenOtherGame(Constants.GAME_PUP_IDOL);
}
private function _onAssetFactoryReady(_arg1:Event):void{
Global.af.removeEventListener(AssetFactory.EVENT_ASSET_FACTORY_READY, _onAssetFactoryReady);
_sfxWon = Global.af.createSound("SFXWin");
_sfxLost = Global.af.createSound("SFXLose");
_sfxButton = Global.af.createSound("SFXButton");
stage.frameRate = Constants.BASE_FPS;
Log.instance().stage = stage;
Log.instance().level = LogLevel.Info;
_mute = (Global.af.createDisplayObject("MuteToggle") as MovieClip);
_mute.x = ((stage.stageWidth - _mute.width) - 6);
_mute.y = ((stage.stageHeight - _mute.height) - 6);
_mute.buttonMode = true;
_mute.useHandCursor = true;
_mute.addEventListener(MouseEvent.CLICK, _onMuteToggled);
addChild(_mute);
_mainMenu = (Global.af.createDisplayObject("MainMenu") as MovieClip);
addChild(_mainMenu);
_muteButtonToTop();
Tracker.init(root, Constants.MEMECOUNTER_CAMPAIGN_ID);
var _local2:Loader = new Loader();
_local2.load(new URLRequest(Constants.WHODIDIT_TRACKING));
_mainMenu.addEventListener(Event.ENTER_FRAME, _setupPlayButton);
}
private function _getHostFromBasePath(_arg1:String):String{
var _local2:int;
if (_arg1.indexOf("http://") == 0){
_arg1 = _arg1.substring(7);
_local2 = _arg1.indexOf("/");
if (_local2 >= 0){
_arg1 = _arg1.substring(0, _local2);
};
};
return (_arg1);
}
private function _getSubmitURL():String{
var _local1:String = _getBasePath();
_local1 = (_local1 + "setuserscore.php");
_local1 = (_local1 + "?");
_local1 = (_local1 + Constants.PARAM_NAME_GAME);
_local1 = (_local1 + "=");
_local1 = (_local1 + escape(Crypto.encrypt(Constants.GAME_ID)));
_local1 = (_local1 + "&");
_local1 = (_local1 + Constants.PARAM_NAME_SCORE);
_local1 = (_local1 + "=");
_local1 = (_local1 + escape(Crypto.encrypt(_game.getScore())));
return (_local1);
}
private function _removeKboardEventL(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == Keyboard.ENTER)) && (!((_foo == null))))){
if (stage.hasEventListener(KeyboardEvent.KEY_DOWN)){
stage.removeEventListener(KeyboardEvent.KEY_DOWN, _foo);
};
_foo(new MouseEvent(MouseEvent.CLICK));
};
}
private function _onStartAnotherGame():void{
if (((!((_gameLost == null))) && (contains(_gameLost)))){
removeChild(_gameLost);
_gameLost = null;
};
if (((!((_gameWon == null))) && (contains(_gameWon)))){
removeChild(_gameWon);
_gameWon = null;
};
_game.dispose();
removeChild(_game);
_game = null;
_doShowGetReady();
}
private function _onOpenMoveOnUp(_arg1:MouseEvent):void{
Tracker.kvClick(493);
_onOpenOtherGame(Constants.GAME_MOVE_ON_UP);
}
private function _submitScoreAndNavigateToHighScoreTable():void{
var _local2:String;
var _local1:String = _getSubmitURL();
_local2 = _getHostFromBasePath(_getBasePath());
var _local3:String = ((loaderInfo.url.indexOf(_local2) >= 0)) ? "_self" : "_blank";
var _local4:URLRequest = new URLRequest(_local1);
navigateToURL(_local4, _local3);
}
}
}//package com.kerb.sammy.hiphop
Section 22
//NoteProgress (com.kerb.sammy.hiphop.NoteProgress)
package com.kerb.sammy.hiphop {
import flash.display.*;
import com.kerb.sammy.hiphop.*;
import com.kerb.sammy.hiphop.interfaces.*;
final class NoteProgress implements IDisposable {
private var _parent:Sprite;// = null
private var _clip:MovieClip;// = null
private static const MARGIN:uint = 5;
function NoteProgress(_arg1:Sprite){
_parent = _arg1;
_clip = (Global.af.createDisplayObject("NoteProgressBar") as MovieClip);
_clip.x = MARGIN;
_clip.y = ((Constants.HEIGHT - _clip.height) - MARGIN);
_parent.addChild(_clip);
setPercentage(0);
}
public function dispose():void{
_parent.removeChild(_clip);
}
public function setPercentage(_arg1:uint):void{
_clip.gotoAndStop(_arg1);
}
}
}//package com.kerb.sammy.hiphop
Section 23
//Preloader (com.kerb.sammy.hiphop.Preloader)
package com.kerb.sammy.hiphop {
import flash.events.*;
import flash.display.*;
import uk.kerb.utils.*;
import flash.utils.*;
public final class Preloader extends MovieClip {
private var _af:AssetFactory;// = null
private var _preloader:MovieClip;// = null
private var swfBytes:Class;
public function Preloader(){
swfBytes = Preloader_swfBytes;
super();
stop();
_af = new AssetFactory();
_af.addEventListener(AssetFactory.EVENT_ASSET_FACTORY_READY, _onAssetFactoryReady);
_af.initialize(swfBytes);
}
private function _onEnterFrame(_arg1:Event):void{
var _local2:Class;
var _local3:Sprite;
var _local4:Number;
var _local5:MovieClip;
if (framesLoaded == totalFrames){
removeEventListener(Event.ENTER_FRAME, _onEnterFrame);
removeChild(_preloader);
_preloader = null;
nextFrame();
_local2 = Class(getDefinitionByName("hiphop"));
if (_local2){
_local3 = (new (_local2) as Sprite);
addChild(_local3);
};
} else {
_local4 = ((100 * root.loaderInfo.bytesLoaded) / root.loaderInfo.bytesTotal);
_local5 = (_preloader.phone_mc.biegething_mc.bar_mc as MovieClip);
if (_local5 != null){
_local5.gotoAndStop(Math.ceil(_local4));
};
};
}
private function _onAssetFactoryReady(_arg1:Event):void{
_af.removeEventListener(AssetFactory.EVENT_ASSET_FACTORY_READY, _onAssetFactoryReady);
_preloader = (_af.createDisplayObject("ZebPreloader") as MovieClip);
addChild(_preloader);
addEventListener(Event.ENTER_FRAME, _onEnterFrame);
}
}
}//package com.kerb.sammy.hiphop
Section 24
//Preloader_swfBytes (com.kerb.sammy.hiphop.Preloader_swfBytes)
package com.kerb.sammy.hiphop {
import mx.core.*;
public class Preloader_swfBytes extends ByteArrayAsset {
}
}//package com.kerb.sammy.hiphop
Section 25
//Sammy (com.kerb.sammy.hiphop.Sammy)
package com.kerb.sammy.hiphop {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import com.kerb.sammy.hiphop.interfaces.*;
public final class Sammy extends EventDispatcher implements IDisposable {
private var _headphones:Point;
private var _walk:MovieClip;// = null
private var _dancing:Boolean;// = false
private var _dance:MovieClip;// = null
private var _parent:Sprite;// = null
public static const EVENT_BREAKDANCE_COMPLETE:String = "onBreakdanceComplete";
public function Sammy(_arg1:Sprite){
_headphones = new Point();
super();
_parent = _arg1;
_walk = (Global.af.createDisplayObject("SammyWalking") as MovieClip);
_parent.addChild(_walk);
_dance = (Global.af.createDisplayObject("SammyDancing") as MovieClip);
_dance.scaleX = -1;
_dance.visible = false;
_parent.addChild(_dance);
}
public function isDancing():Boolean{
return (_dancing);
}
public function walk(_arg1:uint, _arg2:uint):void{
_walk.x = _arg1;
_walk.y = _arg2;
}
private function _onStartDancing(_arg1:Event):void{
_walk.removeEventListener("WalkingFinished", _onStartDancing);
_walk.visible = false;
_dance.addEventListener("BreakdanceFinished", _onStopDancing);
_dance.gotoAndPlay(1);
_dance.visible = true;
}
public function dispose():void{
_parent.removeChild(_walk);
_parent.removeChild(_dance);
}
public function getHeadphonesPos():Point{
_headphones.x = _walk.x;
_headphones.y = _walk.y;
return (_headphones);
}
public function dance():void{
_dance.x = (_walk.x + 16);
_dance.y = (_walk.y + 5);
_dancing = true;
_walk.addEventListener("WalkingFinished", _onStartDancing);
}
public function getX():Number{
return (_walk.x);
}
private function _onStopDancing(_arg1:Event):void{
_dance.removeEventListener("BreakdanceFinished", _onStopDancing);
_dance.visible = false;
_walk.visible = true;
_walk.gotoAndPlay(1);
_dancing = false;
dispatchEvent(new Event(EVENT_BREAKDANCE_COMPLETE));
}
}
}//package com.kerb.sammy.hiphop
Section 26
//ScoreBox (com.kerb.sammy.hiphop.ScoreBox)
package com.kerb.sammy.hiphop {
import flash.events.*;
import flash.display.*;
import com.kerb.sammy.hiphop.*;
import com.kerb.sammy.hiphop.interfaces.*;
import flash.text.*;
final class ScoreBox implements IUpdateable, IRenderable, IDisposable {
private var _countdown:TextField;// = null
private var _parent:Sprite;// = null
private var _clip:MovieClip;// = null
private var _score:TextField;// = null
public var score:uint;// = 0
public var elapsed:uint;// = 0
function ScoreBox(_arg1:Sprite){
_parent = _arg1;
_clip = (Global.af.createDisplayObject("Score") as MovieClip);
_clip.x = -7;
_clip.y = -7;
_clip.addEventListener(Event.ENTER_FRAME, _onSetupClip);
_arg1.addChild(_clip);
}
public function update():void{
var _local1:uint;
var _local2:uint;
var _local3:uint;
var _local4:String;
if (_countdown != null){
if (elapsed < Constants.GAME_LENGTH){
_local1 = Math.floor(((Constants.GAME_LENGTH - elapsed) / 1000));
_local2 = Math.floor((_local1 / 60));
_local3 = Math.floor((_local1 % 60));
_local4 = "";
_local4 = (_local4 + String(_local2));
_local4 = (_local4 + ":");
if (_local3 < 10){
_local4 = (_local4 + "0");
};
_local4 = (_local4 + String(_local3));
_countdown.text = _local4;
} else {
_countdown.text = "0:00";
};
};
if (_score != null){
_score.text = String(score);
};
}
private function _onSetupClip(_arg1:Event):void{
if (_clip.score_mc != null){
_clip.removeEventListener(Event.ENTER_FRAME, _onSetupClip);
_countdown = _clip.score_mc.countdown_txt;
_score = _clip.score_mc.score_txt;
update();
};
}
public function render():void{
}
public function dispose():void{
_parent.removeChild(_clip);
}
}
}//package com.kerb.sammy.hiphop
Section 27
//ScorePopupTexts (com.kerb.sammy.hiphop.ScorePopupTexts)
package com.kerb.sammy.hiphop {
import flash.display.*;
import com.kerb.sammy.hiphop.interfaces.*;
public final class ScorePopupTexts implements IUpdateable, IRenderable, IDisposable {
private var _container:Sprite;// = null
private var _clips:Array;// = null
private var _parent:Sprite;// = null
public function ScorePopupTexts(_arg1:Sprite){
_parent = _arg1;
_container = new Sprite();
_parent.addChild(_container);
_clips = [];
}
public function update():void{
var _local1:Array = _clips.slice();
var _local2:uint = _local1.length;
while (_local2--) {
_local1[_local2].y = (_local1[_local2].y - 1);
_local1[_local2].alpha = (_local1[_local2].alpha - 0.015);
if (_local1[_local2].alpha <= 0){
if (_container.contains(_local1[_local2])){
_container.removeChild(_local1[_local2]);
};
_clips.splice(_local2, 1);
};
};
}
public function addText(_arg1:uint, _arg2:Number, _arg3:Number):void{
var _local4:String = ("Score" + String(_arg1));
var _local5:Sprite = (Global.af.createDisplayObject(_local4) as Sprite);
_local5.x = _arg2;
_local5.y = _arg3;
_clips.push(_local5);
_container.addChild(_local5);
}
public function render():void{
}
public function dispose():void{
var _local1:uint = _clips.length;
while (_local1--) {
if (_container.contains(_clips[_local1])){
_container.removeChild(_clips[_local1]);
};
};
_parent.removeChild(_container);
}
}
}//package com.kerb.sammy.hiphop
Section 28
//Soundtrack (com.kerb.sammy.hiphop.Soundtrack)
package com.kerb.sammy.hiphop {
import flash.events.*;
import flash.display.*;
import uk.kerb.utils.sound.*;
import com.kerb.sammy.hiphop.*;
import com.kerb.sammy.hiphop.interfaces.*;
import com.memecounter.*;
import flash.net.*;
final class Soundtrack implements IDisposable {
public var isPlaying:Boolean;// = false
private var _es:ExtendedSound;// = null
private var _fadingOut:Boolean;// = false
function Soundtrack(_arg1:Sprite){
_es = Global.af.createSound("MainMusicTrack");
var _local2:Sprite = (Global.af.createDisplayObject("ArtistCredits") as Sprite);
_local2.x = 338;
_local2.y = 372;
_arg1.addChild(_local2);
_local2.buttonMode = true;
_local2.useHandCursor = true;
_local2.addEventListener(MouseEvent.CLICK, _onCreditsClicked);
}
public function stop():void{
_es.stop();
isPlaying = false;
}
private function _onCreditsClicked(_arg1:MouseEvent):void{
var mouseEvent = _arg1;
var urlRequest:URLRequest = new URLRequest(Constants.NEOLICIOUS_LINK);
try {
navigateToURL(urlRequest, "_blank");
} catch(e:Error) {
};
Tracker.kvClick(Constants.MEMECOUNTER_NEOLICIOUS_TRACKING);
var loader:Loader = new Loader();
loader.load(new URLRequest(Constants.MUSIC_CREDIT_TRACKING));
}
public function fadeOut():void{
_es.fadeOut(Constants.SOUNDTRACK_FADE_OUT_PERIOD);
_fadingOut = true;
}
public function play():void{
_es.play(0, Constants.AD_NAUSEUM);
isPlaying = true;
}
public function setVolume(_arg1:Number):void{
if (_fadingOut){
return;
};
if (!isPlaying){
play();
};
_es.setVolume((Constants.SOUNDTRACK_VOLUME_FACTOR * _arg1));
}
public function dispose():void{
}
}
}//package com.kerb.sammy.hiphop
Section 29
//UnidentifiedFlyingObject (com.kerb.sammy.hiphop.UnidentifiedFlyingObject)
package com.kerb.sammy.hiphop {
import flash.events.*;
import flash.display.*;
import uk.kerb.utils.sound.*;
import flash.geom.*;
import com.kerb.sammy.hiphop.interfaces.*;
public final class UnidentifiedFlyingObject extends EventDispatcher implements IUpdateable, IRenderable, IDisposable {
private var _v:Point;
private var _parent:Sprite;// = null
private var _ufo:MovieClip;// = null
private var _rightThrust:Boolean;// = false
private var _explosion:MovieClip;// = null
private var _leftThrust:Boolean;// = false
public var exploding:Boolean;// = false
private var _sfxExplosion:ExtendedSound;// = null
private var _p:Point;
private var _thrust:Boolean;// = false
private var _aabb:AABB;// = null
private static const BUFFER:Number = 5;
private static const X_ACCEL:Number = 0.6;
private static const ASSET_OFFSET:Point = new Point(0, 0);
private static const MAX_X_SPEED:uint = 3;
private static const MAX_Y_SPEED:uint = 4;
public static const EVENT_EXPLOSION_COMPLETE:String = "ExplosionComplete";
private static const VELOCITY_DAMPING_FACTOR:Number = 0.9;
private static const MAX_Y_COORD:uint = 210;
private static const MAX_TILT:uint = 17;
public function UnidentifiedFlyingObject(_arg1:Sprite, _arg2:Number, _arg3:Number, _arg4:Number=0, _arg5:Number=0){
_p = new Point();
_v = new Point();
super();
_p.x = _arg2;
_p.y = _arg3;
_v.x = _arg4;
_v.y = _arg5;
_parent = _arg1;
_ufo = (Global.af.createDisplayObject("UFO") as MovieClip);
_ufo.cacheAsBitmap = true;
_explosion = (Global.af.createDisplayObject("Explosion") as MovieClip);
_explosion.visible = false;
_explosion.stop();
_ufo.scaleX = (_ufo.scaleY = 0.54);
_setAssetPosition();
_parent.addChild(_ufo);
_parent.addChild(_explosion);
_aabb = new AABB();
_sfxExplosion = Global.af.createSound("SFXExplosion");
}
public function setLeftThrust(_arg1:Boolean):void{
_leftThrust = _arg1;
}
public function getX():Number{
return (_p.x);
}
public function getY():Number{
return (_p.y);
}
public function setRedLight(_arg1:Boolean):void{
_ufo.ufo_mc.red_mc.visible = _arg1;
_ufo.ufo_mc.white_mc.visible = !(_arg1);
}
private function _setAssetPosition():void{
_ufo.x = (_p.x - ASSET_OFFSET.x);
_ufo.y = (_p.y - ASSET_OFFSET.y);
}
public function update():void{
var _local1:int;
_v.x = (_v.x * VELOCITY_DAMPING_FACTOR);
if (Math.abs(_v.x) < 0.001){
_v.x = 0;
};
if (_leftThrust){
_v.x = (_v.x - X_ACCEL);
} else {
if (_rightThrust){
_v.x = (_v.x + X_ACCEL);
};
};
if (_thrust){
_v.y = (_v.y - (2.25 * Constants.GRAVITY));
};
_v.y = (_v.y + Constants.GRAVITY);
if (Math.abs(_v.x) > MAX_X_SPEED){
_local1 = ((_v.x < 0)) ? -1 : 1;
_v.x = (_local1 * Math.min(MAX_X_SPEED, Math.abs(_v.x)));
};
if (Math.abs(_v.y) > MAX_Y_SPEED){
_local1 = ((_v.y < 0)) ? -1 : 1;
_v.y = (_local1 * Math.min(MAX_Y_SPEED, Math.abs(_v.y)));
};
_p.x = (_p.x + _v.x);
_p.y = (_p.y + _v.y);
if ((_p.x - (_ufo.width / 2)) < BUFFER){
_p.x = (BUFFER + (_ufo.width / 2));
} else {
if ((_p.x + (_ufo.width / 2)) > (Constants.WIDTH - BUFFER)){
_p.x = ((Constants.WIDTH - BUFFER) - (_ufo.width / 2));
};
};
if ((_p.y - (_ufo.height / 2)) < BUFFER){
_p.y = (BUFFER + (_ufo.height / 2));
_v.y = 0;
} else {
if (_p.y > MAX_Y_COORD){
_p.y = MAX_Y_COORD;
_v.y = 0;
};
};
}
private function _onExplosionComplete(_arg1:Event):void{
_explosion.removeEventListener("ExplosionComplete", _onExplosionComplete);
if (_parent.contains(_explosion)){
_parent.removeChild(_explosion);
};
dispatchEvent(new Event(EVENT_EXPLOSION_COMPLETE));
}
public function setRightThrust(_arg1:Boolean):void{
_rightThrust = _arg1;
}
public function setThrust(_arg1:Boolean):void{
_thrust = _arg1;
}
public function render():void{
_setAssetPosition();
_ufo.rotation = ((MAX_TILT * _v.x) / MAX_X_SPEED);
}
public function getVX():Number{
return (_v.x);
}
public function getVY():Number{
return (_v.y);
}
public function explode():void{
if (_parent.contains(_ufo)){
_parent.removeChild(_ufo);
};
_explosion.x = _ufo.x;
_explosion.y = _ufo.y;
_explosion.addEventListener("ExplosionComplete", _onExplosionComplete);
_explosion.gotoAndPlay(1);
_explosion.visible = true;
exploding = true;
_sfxExplosion.play();
}
public function getAngle():Number{
var _local1:Number = 0;
_local1 = Math.atan2(-(_v.y), _v.x);
return (_local1);
}
public function dispose():void{
if (_parent.contains(_ufo)){
_parent.removeChild(_ufo);
};
if (_parent.contains(_explosion)){
_parent.removeChild(_explosion);
};
}
public function getAABB():AABB{
_aabb.min.x = (_p.x - Constants.HALF_UFO_WIDTH);
_aabb.min.y = (_p.y - Constants.HALF_UFO_HEIGHT);
_aabb.max.x = (_p.x + Constants.HALF_UFO_WIDTH);
_aabb.max.y = (_p.y + Constants.HALF_UFO_HEIGHT);
return (_aabb);
}
}
}//package com.kerb.sammy.hiphop
Section 30
//Tracker (com.memecounter.Tracker)
package com.memecounter {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class Tracker {
private static var ori_dom:String;
private static var lurl:String;
private static var _isReady:Boolean = false;
public static var a:uint = 0;
public static var root:DisplayObject;
public static var c:uint;
public static var d:String = "";
private static var _isInited:Boolean = false;
public static var fpv:String = "";
private static var l:Loader;
private static var tracker:MovieClip;
public static var da:Array = ["distralytics.com", "distralytics.co.uk"];
private static function loadError(_arg1:Event):void{
a++;
lc();
}
public static function init(_arg1:DisplayObject, _arg2:uint):void{
var _local3:uint;
if (!_isInited){
_isInited = true;
root = _arg1;
Tracker.c = _arg2;
_local3 = 0;
while (_local3 < da.length) {
Security.allowDomain(da[_local3], ((_arg2 + ".c.") + da[_local3]), ("*." + da[_local3]));
_local3++;
};
ori_dom = (root.hasOwnProperty("ori_dom")) ? root["ori_dom"] : "";
d = ((ori_dom)!="") ? ori_dom : ((root.loaderInfo.loaderURL.split("/")[0].indexOf("http"))==-1) ? "Local" : root.loaderInfo.loaderURL.split("/")[2].split("?")[0];
fpv = Capabilities.version.split(" ")[1].split(",")[0];
lurl = ((((((((("/control/tracking/trackerAS3.swf" + "?c=") + _arg2) + "&r=") + Math.floor((Math.random() * 10000000000))) + "&d=") + d) + "&p=") + fpv) + "&as=3");
l = new Loader();
l.contentLoaderInfo.addEventListener(Event.INIT, loadComplete);
l.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
lc();
};
}
public static function get isReady():Boolean{
return (isReady);
}
public static function kvClick(_arg1:uint):void{
if (_isReady){
tracker.kvClick(_arg1);
};
}
public static function kvCountry():String{
if (_isReady){
return (tracker.kvCountry());
};
return ("");
}
public static function kvEvent(_arg1:uint):void{
if (_isReady){
tracker.kvEvent(_arg1);
};
}
private static function lc():void{
var _local1:String = (((("http://" + c) + ".c.") + da[(a % da.length)]) + lurl);
Security.allowDomain(_local1);
l.load(new URLRequest(_local1));
}
private static function loadComplete(_arg1:Event):void{
tracker = _arg1.target.content;
tracker.init(getDefinitionByName("com.memecounter.Tracker"), root);
_isReady = true;
}
}
}//package com.memecounter
Section 31
//ByteArrayAsset (mx.core.ByteArrayAsset)
package mx.core {
import flash.utils.*;
public class ByteArrayAsset extends ByteArray implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
}
}//package mx.core
Section 32
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 33
//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 34
//Log (uk.kerb.utils.logger.Log)
package uk.kerb.utils.logger {
import flash.events.*;
import flash.display.*;
public final class Log extends EventDispatcher {
private var _view:View;
private var _level:LogLevel;
private var _entries:Array;
private static const MAX_ENTRIES:uint = 100;
private static var _allow:Boolean = false;
private static var _instance:Log = null;
public function Log(){
if (!_allow){
throw (new Error("direct instantiation of uk.kerb.utils.logger.Log is forbidden"));
};
_entries = new Array();
_level = LogLevel.Info;
_view = new View(this);
}
public function set stage(_arg1:Stage):void{
_view.stage = _arg1;
}
private function _add(_arg1:String):void{
_entries.push(new LogEntry(_arg1));
if (_entries.length > MAX_ENTRIES){
_entries.shift();
};
}
public function fatal(_arg1:String):void{
_add(_arg1);
if ((((((_level == LogLevel.Fatal)) || ((_level == LogLevel.Info)))) || ((_level == LogLevel.Debug)))){
_dispatch();
};
}
public function info(_arg1:String):void{
_add(_arg1);
if ((((_level == LogLevel.Info)) || ((_level == LogLevel.Debug)))){
_dispatch();
};
}
public function set level(_arg1:LogLevel):void{
_level = _arg1;
}
private function _dispatch():void{
dispatchEvent(new LogEvent(_entries[(_entries.length - 1)]));
}
public function debug(_arg1:String):void{
_add(_arg1);
if (_level == LogLevel.Debug){
_dispatch();
};
}
public function get level():LogLevel{
return (_level);
}
public static function instance():Log{
if (_instance == null){
_allow = true;
_instance = new (Log);
_allow = false;
};
return (_instance);
}
}
}//package uk.kerb.utils.logger
Section 35
//LogEntry (uk.kerb.utils.logger.LogEntry)
package uk.kerb.utils.logger {
final class LogEntry {
private var _message:String;
private var _date:Date;
function LogEntry(_arg1:String){
_message = _arg1;
_date = new Date();
}
public function get message():String{
return (_message);
}
public function get date():Date{
return (_date);
}
}
}//package uk.kerb.utils.logger
Section 36
//LogEvent (uk.kerb.utils.logger.LogEvent)
package uk.kerb.utils.logger {
import flash.events.*;
final class LogEvent extends Event {
private var _logEntry:LogEntry;
public static const TYPE:String = "onLogEntry";
function LogEvent(_arg1:LogEntry){
super(TYPE);
_logEntry = _arg1;
}
public function get logEntry():LogEntry{
return (_logEntry);
}
}
}//package uk.kerb.utils.logger
Section 37
//LogLevel (uk.kerb.utils.logger.LogLevel)
package uk.kerb.utils.logger {
public final class LogLevel {
public static const Debug:LogLevel = new (LogLevel);
;
public static const Fatal:LogLevel = new (LogLevel);
;
public static const Info:LogLevel = new (LogLevel);
;
public static const None:LogLevel = new (LogLevel);
;
}
}//package uk.kerb.utils.logger
Section 38
//View (uk.kerb.utils.logger.View)
package uk.kerb.utils.logger {
import flash.events.*;
import flash.display.*;
import uk.kerb.utils.logger.*;
import flash.utils.*;
import flash.text.*;
import uk.kerb.utils.misc.*;
import flash.ui.*;
import flash.system.*;
final class View {
private var _dragBar:Sprite;
private var _container:Sprite;
private var _log:Log;
private var _timer:Timer;// = null
private var _closeButton:Sprite;
private var _minimized:Boolean;// = false
private var _textField:TextField;
private var _minButton:Sprite;
private var _frames:uint;// = 0
private var _fps:TextField;
private var _greyBox:Sprite;
private var _stage:Stage;
private static const DRAG_BAR_HEIGHT:uint = 10;
private static const HEIGHT:uint = 100;
private static const COLOUR_BLUE:uint = 0xFF;
private static const MARGIN:uint = 5;
private static const COLOUR_GREY:uint = 0x999999;
private static const BUTTON_LENGTH:uint = 10;
private static const DISPLAY_FONT_SIZE:uint = 11;
private static const COLOUR_WHITE:uint = 0xFFFFFF;
private static const COLOUR_RED:uint = 0xFF0000;
private static const DISPLAY_FONT_COLOUR:uint = 0xFFFFFF;
function View(_arg1:Log){
_log = _arg1;
_log.addEventListener(LogEvent.TYPE, _eventHandler);
_timer = new Timer(1000);
_timer.addEventListener(TimerEvent.TIMER, _onTimer);
}
private function _onCloseButtonClick(_arg1:MouseEvent):void{
_container.visible = false;
}
private function _createMinButton():void{
_minButton = new Sprite();
_minButton.x = ((_container.width - (2.5 * BUTTON_LENGTH)) - MARGIN);
_minButton.y = MARGIN;
_minButton.graphics.beginFill(COLOUR_RED);
_minButton.graphics.lineStyle(1, COLOUR_WHITE);
_minButton.graphics.drawRect(0, 0, BUTTON_LENGTH, BUTTON_LENGTH);
_minButton.graphics.endFill();
_minButton.graphics.moveTo(0, (BUTTON_LENGTH / 2));
_minButton.graphics.lineTo(BUTTON_LENGTH, (BUTTON_LENGTH / 2));
_minButton.buttonMode = true;
_minButton.addEventListener(MouseEvent.CLICK, _onMinButtonClick, false, 0, true);
_container.addChild(_minButton);
}
private function _createGraphics():void{
if (_container == null){
_createContainer();
_createDragBar();
_createFPSTextField();
_createCloseButton();
_createMinButton();
_createTextField();
_container.addEventListener(MouseEvent.MOUSE_OVER, _onMouseOver);
_timer.start();
_container.addEventListener(Event.ENTER_FRAME, _onEnterFrame);
_doMinButtonClick();
} else {
if (!_container.visible){
_container.visible = true;
};
};
}
private function _onEnterFrame(_arg1:Event):void{
_frames++;
}
private function _onDragBarMouseUp(_arg1:MouseEvent):void{
_container.removeEventListener(MouseEvent.MOUSE_MOVE, _onContainerMouseMove);
_container.stopDrag();
}
private function _onDragBarMouseDown(_arg1:MouseEvent):void{
_container.addEventListener(MouseEvent.MOUSE_MOVE, _onContainerMouseMove);
_container.startDrag();
}
private function _createFPSTextField():void{
_fps = new TextField();
_fps.x = MARGIN;
_fps.y = 1;
_fps.width = 100;
_fps.height = 30;
_fps.autoSize = TextFieldAutoSize.NONE;
_fps.embedFonts = false;
_fps.antiAliasType = AntiAliasType.NORMAL;
_fps.wordWrap = true;
_fps.selectable = false;
_fps.mouseEnabled = false;
_fps.defaultTextFormat = new TextFormat("_typewriter", DISPLAY_FONT_SIZE, DISPLAY_FONT_COLOUR);
_container.addChild(_fps);
}
private function _onMinButtonClick(_arg1:MouseEvent):void{
_doMinButtonClick();
}
private function _createDragBar():void{
_dragBar = new Sprite();
_dragBar.x = 0;
_dragBar.y = 0;
_dragBar.graphics.beginFill(COLOUR_BLUE);
_dragBar.graphics.lineStyle(0, COLOUR_WHITE, 0);
_dragBar.graphics.drawRect(0, 0, _container.width, (2 * BUTTON_LENGTH));
_dragBar.graphics.endFill();
_dragBar.buttonMode = true;
_dragBar.addEventListener(MouseEvent.MOUSE_DOWN, _onDragBarMouseDown, false, 0, true);
_dragBar.addEventListener(MouseEvent.MOUSE_UP, _onDragBarMouseUp, false, 0, true);
_container.addChild(_dragBar);
}
private function _createContainer():void{
_container = new Sprite();
_container.x = MARGIN;
_container.y = ((_stage.stageHeight - HEIGHT) - MARGIN);
_greyBox = new Sprite();
_greyBox.graphics.beginFill(COLOUR_GREY);
_greyBox.graphics.drawRect(0, 0, (_stage.stageWidth - (2 * MARGIN)), (HEIGHT - (2 * BUTTON_LENGTH)));
_greyBox.graphics.endFill();
_greyBox.y = (2 * BUTTON_LENGTH);
_container.addChild(_greyBox);
_stage.addChild(_container);
}
private function _onTimer(_arg1:TimerEvent):void{
_fps.text = (String(_frames) + " fps");
_frames = 0;
}
private function _eventHandler(_arg1:LogEvent):void{
var _local2:String;
_createGraphics();
if (_textField != null){
_local2 = ((Convert.timeTo24HourString(_arg1.logEntry.date) + ": ") + _arg1.logEntry.message);
_textField.appendText((_local2 + "\n"));
trace(_local2);
_textField.scrollV = _textField.maxScrollV;
System.setClipboard(_textField.text);
};
}
private function _doMinButtonClick():void{
_minimized = !(_minimized);
_greyBox.visible = !(_minimized);
_textField.visible = !(_minimized);
_container.y = ((_stage.stageHeight - (_minimized) ? (2 * BUTTON_LENGTH) : HEIGHT) - MARGIN);
}
private function _createTextField():void{
_textField = new TextField();
_textField.x = MARGIN;
_textField.y = ((2 * BUTTON_LENGTH) + MARGIN);
_textField.width = (_container.width - (2 * MARGIN));
_textField.height = ((_container.height - (2 * BUTTON_LENGTH)) - (2 * MARGIN));
_textField.autoSize = TextFieldAutoSize.NONE;
_textField.embedFonts = false;
_textField.antiAliasType = AntiAliasType.NORMAL;
_textField.wordWrap = true;
_textField.defaultTextFormat = new TextFormat("_typewriter", DISPLAY_FONT_SIZE, DISPLAY_FONT_COLOUR);
_container.addChild(_textField);
}
private function _createCloseButton():void{
_closeButton = new Sprite();
_closeButton.x = ((_container.width - BUTTON_LENGTH) - MARGIN);
_closeButton.y = MARGIN;
_closeButton.graphics.beginFill(COLOUR_RED);
_closeButton.graphics.lineStyle(1, COLOUR_WHITE);
_closeButton.graphics.drawRect(0, 0, BUTTON_LENGTH, BUTTON_LENGTH);
_closeButton.graphics.endFill();
_closeButton.graphics.moveTo(0, 0);
_closeButton.graphics.lineTo(BUTTON_LENGTH, BUTTON_LENGTH);
_closeButton.graphics.moveTo(BUTTON_LENGTH, 0);
_closeButton.graphics.lineTo(0, BUTTON_LENGTH);
_closeButton.buttonMode = true;
_closeButton.addEventListener(MouseEvent.CLICK, _onCloseButtonClick, false, 0, true);
_container.addChild(_closeButton);
}
private function _onContainerMouseMove(_arg1:MouseEvent):void{
_arg1.updateAfterEvent();
}
private function _onMouseOver(_arg1:MouseEvent):void{
Mouse.show();
}
public function set stage(_arg1:Stage):void{
_stage = _arg1;
}
}
}//package uk.kerb.utils.logger
Section 39
//Convert (uk.kerb.utils.misc.Convert)
package uk.kerb.utils.misc {
public final class Convert {
public function Convert(){
throw (new Error("direct instantiation of uk.kerb.utils.misc.Convert is forbidden"));
}
public static function numberToFixedLengthString(_arg1:Number, _arg2:uint=4, _arg3:uint=4, _arg4:String=" "):String{
var _local5:String = String(((_arg1 == 0)) ? _arg1 : _arg1.toFixed(_arg3));
var _local6:uint = _arg2;
if (_arg3 > 0){
_local6 = (_local6 + (1 + _arg3));
};
_arg4 = _arg4.charAt(0);
while (_local5.length < _local6) {
_local5 = (_arg4 + _local5);
};
return (_local5);
}
public static function timeTo24HourString(_arg1:Date):String{
var _local2 = "";
_local2 = (_local2 + numberToFixedLengthString(_arg1.getHours(), 2, 0, "0"));
_local2 = (_local2 + ":");
_local2 = (_local2 + numberToFixedLengthString(_arg1.getMinutes(), 2, 0, "0"));
_local2 = (_local2 + ":");
_local2 = (_local2 + numberToFixedLengthString(_arg1.getSeconds(), 2, 0, "0"));
return (_local2);
}
}
}//package uk.kerb.utils.misc
Section 40
//ExtendedSound (uk.kerb.utils.sound.ExtendedSound)
package uk.kerb.utils.sound {
import flash.events.*;
import flash.media.*;
import flash.utils.*;
public class ExtendedSound extends Sound {
private var fadeStartVolume:Number;
private var fadeEndVolume:Number;
private var panStartPosition:Number;
private var panDuration:Number;
private var panEndPosition:Number;
private var fadeTimer:Timer;
private var panTimer:Timer;
private var fadeDuration:Number;
private var panStartTime:Number;
private var fadeStartTime:Number;
private var soundChannel:SoundChannel;
private static const TIMER_UPDATE_RATE:Number = 20;
public function fadeIn(_arg1:Number=0, _arg2:Number=1, _arg3:Number=0, _arg4:int=0, _arg5:Number=0):SoundChannel{
fadeStartVolume = Math.max(0, Math.min(1, _arg1));
soundChannel = super.play(_arg5, _arg4, new SoundTransform(fadeStartVolume));
if (_arg3 > 0){
fadeStartTime = getTimer();
fadeDuration = _arg3;
fadeEndVolume = Math.max(0, Math.min(1, _arg2));
startFade();
};
return (soundChannel);
}
public function stop():void{
if (soundChannel != null){
soundChannel.stop();
};
}
public function fadeOut(_arg1:Number=0):void{
if (_arg1 > 0){
fadeStartTime = getTimer();
fadeDuration = _arg1;
fadeStartVolume = soundChannel.soundTransform.volume;
fadeEndVolume = 0;
startFade();
} else {
stop();
};
}
protected function stopPan():void{
if (((!((panTimer == null))) && (panTimer.running))){
panTimer.reset();
};
}
protected function updatePan(_arg1:TimerEvent):void{
var _local2:Number;
var _local3:Number = ((getTimer() - panStartTime) / panDuration);
if (_local3 >= 1){
stopPan();
_local2 = panEndPosition;
} else {
if (_local3 > 0){
_local2 = ((_local3 * (panEndPosition - panStartPosition)) + panStartPosition);
};
};
var _local4:Number = soundChannel.soundTransform.volume;
soundChannel.soundTransform = new SoundTransform(_local4, _local2);
}
public function setPan(_arg1:Number):void{
var _local2:Number;
if (soundChannel != null){
_arg1 = Math.max(-1, Math.min(1, _arg1));
_local2 = soundChannel.soundTransform.volume;
soundChannel.soundTransform = new SoundTransform(_local2, _arg1);
stopPan();
};
}
protected function stopFade():void{
if (((!((fadeTimer == null))) && (fadeTimer.running))){
fadeTimer.reset();
};
}
public function setVolume(_arg1:Number):void{
var _local2:Number;
if (soundChannel != null){
_arg1 = Math.max(0, Math.min(1, _arg1));
_local2 = soundChannel.soundTransform.pan;
soundChannel.soundTransform = new SoundTransform(_arg1, _local2);
stopFade();
};
}
protected function updateFade(_arg1:TimerEvent):void{
var _local2:Number;
var _local3:Number = ((getTimer() - fadeStartTime) / fadeDuration);
if (_local3 >= 1){
stopFade();
_local2 = fadeEndVolume;
} else {
if (_local3 > 0){
_local2 = ((_local3 * (fadeEndVolume - fadeStartVolume)) + fadeStartVolume);
};
};
var _local4:Number = soundChannel.soundTransform.pan;
soundChannel.soundTransform = new SoundTransform(_local2, _local4);
}
protected function startPan():void{
if (panTimer == null){
panTimer = new Timer(TIMER_UPDATE_RATE);
panTimer.addEventListener(TimerEvent.TIMER, updatePan);
};
stopPan();
panTimer.start();
}
public function panTo(_arg1:Number, _arg2:Number):void{
if (_arg2 > 0){
panStartTime = getTimer();
panDuration = _arg2;
panStartPosition = soundChannel.soundTransform.pan;
panEndPosition = _arg1;
startPan();
} else {
setPan(_arg1);
};
}
override public function play(_arg1:Number=0, _arg2:int=0, _arg3:SoundTransform=null):SoundChannel{
soundChannel = super.play(_arg1, _arg2, _arg3);
return (soundChannel);
}
protected function startFade():void{
if (fadeTimer == null){
fadeTimer = new Timer(TIMER_UPDATE_RATE);
fadeTimer.addEventListener(TimerEvent.TIMER, updateFade);
};
stopFade();
fadeTimer.start();
}
}
}//package uk.kerb.utils.sound
Section 41
//SoundManager (uk.kerb.utils.sound.SoundManager)
package uk.kerb.utils.sound {
import flash.media.*;
public class SoundManager {
private var sounds:Array;
private var preMuteVolume:Number;// = 1
private var muteState:Boolean;// = false
private var masterVolume:Number;// = 1
private static var allowInstantiation:Boolean = false;
private static var instance:SoundManager = null;
public function SoundManager(){
sounds = new Array();
super();
if (((!(allowInstantiation)) || (!((instance == null))))){
throw (new Error("SoundManager is a singleton - use SoundManager.getInstance()"));
};
}
public function stopAllSounds():void{
SoundMixer.stopAll();
}
public function getSoundFromID(_arg1:String):ExtendedSound{
return (sounds[_arg1]);
}
public function get muted():Boolean{
return (muteState);
}
public function registerSound(_arg1:ExtendedSound, _arg2:String):void{
if (sounds[_arg2] != null){
throw (new Error((("ID conflict: A sound with the id [" + _arg2) + "] already exists in SoundManager's sound list.")));
};
sounds[_arg2] = _arg1;
}
public function unmute():void{
muteState = false;
setMasterVolume(preMuteVolume);
}
public function mute():void{
muteState = true;
preMuteVolume = masterVolume;
setMasterVolume(0);
}
public function setMasterVolume(_arg1:Number):void{
masterVolume = Math.max(0, Math.min(1, _arg1));
var _local2:SoundTransform = SoundMixer.soundTransform;
_local2.volume = masterVolume;
SoundMixer.soundTransform = _local2;
}
public static function getInstance():SoundManager{
if (instance == null){
allowInstantiation = true;
instance = new (SoundManager);
allowInstantiation = false;
};
return (instance);
}
}
}//package uk.kerb.utils.sound
Section 42
//AssetFactory (uk.kerb.utils.AssetFactory)
package uk.kerb.utils {
import flash.events.*;
import flash.display.*;
import uk.kerb.utils.sound.*;
public final class AssetFactory extends EventDispatcher {
private var _loader:Loader;// = null
public static const EVENT_ASSET_FACTORY_READY:String = "EVENT_ASSET_FACTORY_READY";
public function initialize(_arg1:Class):void{
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(Event.INIT, _onLibraryReady);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, _onIOError);
_loader.loadBytes(new (_arg1));
}
public function createSound(_arg1:String):ExtendedSound{
var _local2:Class = Class(_loader.contentLoaderInfo.applicationDomain.getDefinition(_arg1));
return ((new (_local2) as ExtendedSound));
}
public function createDisplayObject(_arg1:String):DisplayObject{
var _local2:Class = Class(_loader.contentLoaderInfo.applicationDomain.getDefinition(_arg1));
return ((new (_local2) as DisplayObject));
}
private function _onLibraryReady(_arg1:Event):void{
_loader.contentLoaderInfo.removeEventListener(Event.INIT, _onLibraryReady);
dispatchEvent(new Event(EVENT_ASSET_FACTORY_READY));
}
private function _onIOError(_arg1:Event):void{
}
}
}//package uk.kerb.utils
Section 43
//Crypto (uk.kerb.utils.Crypto)
package uk.kerb.utils {
public class Crypto {
private static var KEYS:Array = new Array("98sdfa23Ql", "ADF8b3w2fq", "ER2b79hwfO", "clkenf0FSj", "4R7d6ASYU3", "ASDQsjhW02", "kCQ6YH9asc", "ADIx7g19SP", "Nd98fhiOAF", "a09hADNFkf");
private static var SALT:String = "8008135";
public static function encrypt(_arg1:int):String{
var _local2:String = ((_arg1 + "") + SALT);
var _local3 = "";
var _local4:int = Math.floor((Math.random() * KEYS.length));
var _local5:int = _local4;
var _local6:int;
while (_local6 < _local2.length) {
_local3 = (_local3 + KEYS[_local5].charAt(parseInt(_local2.charAt(_local6))));
_local5 = ((_local5 + 1) % KEYS.length);
_local6++;
};
_local3 = (_local3 + ("" + _local4));
return (_local3);
}
public static function decrypt(_arg1:String):int{
var _local6:int;
var _local2:int = parseInt(_arg1.substr(-1));
var _local3:String = _arg1.substr(0, (_arg1.length - 1));
var _local4 = "";
var _local5:int;
while (_local5 < _local3.length) {
_local6 = KEYS[_local2].indexOf(_local3.charAt(_local5));
if (_local6 > -1){
_local4 = (_local4 + ("" + _local6));
} else {
return (0);
};
_local2 = ((_local2 + 1) % KEYS.length);
_local5++;
};
if (_local4.substr(-(SALT.length)) != SALT){
return (0);
};
return (parseInt(_local4.substr(0, (_local4.length - SALT.length))));
}
}
}//package uk.kerb.utils
Section 44
//hiphop (hiphop)
package {
import flash.display.*;
import com.kerb.sammy.hiphop.*;
public class hiphop extends Sprite {
private var swfBytes:Class;
public function hiphop(){
swfBytes = hiphop_swfBytes;
super();
addChild(new Main(swfBytes));
}
}
}//package
Section 45
//hiphop_swfBytes (hiphop_swfBytes)
package {
import mx.core.*;
public class hiphop_swfBytes extends ByteArrayAsset {
}
}//package