Frame 3
if (_root.getBytesLoaded() >= _root.getBytesTotal()) {
gotoAndPlay(_currentframe + 1);
} else {
gotoAndPlay(_currentframe - 1);
}
Frame 4
var jello = new JelloMain(mc_total);
jello.init();
Frame 7
stop();
Symbol 4 MovieClip [hitarea mid] Frame 1
#initclip 14
Object.registerClass("hitarea mid", JelloHitAreaMid);
#endinitclip
Symbol 6 MovieClip [hitarea b 1] Frame 1
#initclip 6
Object.registerClass("hitarea b 1", JelloHitArea);
#endinitclip
Symbol 8 MovieClip [hitarea b 2] Frame 1
#initclip 7
Object.registerClass("hitarea b 2", JelloHitArea);
#endinitclip
Symbol 10 MovieClip [hitarea c 2] Frame 1
#initclip 8
Object.registerClass("hitarea c 2", JelloHitArea);
#endinitclip
Symbol 12 MovieClip [hitarea a 2] Frame 1
#initclip 9
Object.registerClass("hitarea a 2", JelloHitArea);
#endinitclip
Symbol 14 MovieClip [hitarea d 2] Frame 1
#initclip 10
Object.registerClass("hitarea d 2", JelloHitArea);
#endinitclip
Symbol 16 MovieClip [hitarea d 1] Frame 1
#initclip 11
Object.registerClass("hitarea d 1", JelloHitArea);
#endinitclip
Symbol 18 MovieClip [hitarea a 1] Frame 1
#initclip 12
Object.registerClass("hitarea a 1", JelloHitArea);
#endinitclip
Symbol 20 MovieClip [hitarea c 1] Frame 1
#initclip 13
Object.registerClass("hitarea c 1", JelloHitArea);
#endinitclip
Symbol 21 MovieClip Frame 1
function onSelectURLItem(obj, menuItem) {
getURL (menuItem.url, "_blank");
}
var items = [];
items[0] = {label:"jello time .com"};
items[1] = {label:"by Rafa\u00EBl Rozendaal, 2007", url:"http://www.newrafael.com"};
items[2] = {label:"programming by Reinier Feijen", url:"http://www.boxofchocolates.nl"};
var defaultItems = {zoom:true, quality:true, loop:false, play:false, print:true, rewind:false, forwardAndBack:false, save:true};
var enableTextItems = false;
var myContextMenu = new ContextMenu();
var i = 0;
while (i < items.length) {
var item = new ContextMenuItem(items[i].label, function () {
});
if (items[i].separatorBefore != null) {
item.separatorBefore = items[i].separatorBefore;
}
if (items[i].url != null) {
item.url = items[i].url;
item.onSelect = onSelectURLItem;
} else {
item.enabled = enableTextItems;
}
myContextMenu.customItems.push(item);
i++;
}
for (var s in defaultItems) {
myContextMenu.builtInItems[s] = defaultItems[s];
}
this._parent.menu = myContextMenu;
Symbol 87 MovieClip [__Packages.JelloHitArea] Frame 0
class JelloHitArea extends MovieClip
{
var _alpha, type, _name, onRollOver, onDragOver, onRollOut, onDragOut, useHandCursor;
function JelloHitArea () {
super();
_alpha = 0;
type = _name.substr(4, 1);
enable();
}
function getController() {
return(_root.jello);
}
function _onRollOver() {
getController().onJelloHit(type);
}
function _onRollOut() {
getController().onJelloOut(type);
}
function enable(b) {
if (!(b === false)) {
onRollOver = (onDragOver = _onRollOver);
onRollOut = (onDragOut = _onRollOut);
useHandCursor = JelloConfig.use_hand_cursor;
} else {
onRollOver = (onDragOver = null);
onRollOut = (onDragOut = null);
useHandCursor = false;
}
}
}
Symbol 88 MovieClip [__Packages.JelloConfig] Frame 0
class JelloConfig
{
function JelloConfig () {
}
static var use_the_force = false;
static var force_map = [0, 10];
static var force_min = 0.5;
static var use_hand_cursor = false;
static var endloops_factor = 40;
static var end_silent_frames = 4;
static var endloop_sound_correction = 1;
static var time_between_starts = 500;
static var mousespeed_detection_threshold = 5;
static var mid_sound_offset = 500;
static var loop_offset = 1022;
static var tremor_endloop = [[1, 1], [-1, 1]];
static var tremor = [[0, 1], [10, 1], [-10, 1], [9, 1], [-9, 1], [8, 1], [-8, 1], [7, 1], [-7, 1], [6, 1], [-6, 1], [5, 1], [-5, 1], [4, 1], [-4, 1], [3, 1], [-3, 1], [3, 1], [-3, 1], [3, 1], [-3, 1], [2, 1], [-2, 1], [2, 1], [-2, 1], [2, 1], [-2, 1], [2, 1], [-2, 1], [1, 1], [-1, 1], [1, 1], [-1, 1], [1, 1], [-1, 1], [1, 1], [-1, 1], [1, 1], [-1, 1]];
}
Symbol 89 MovieClip [__Packages.JelloHitAreaMid] Frame 0
class JelloHitAreaMid extends MovieClip
{
var _alpha, mc_debug, onMouseMove, onMouseUp, mouse_path, mouse_orig, onRollOver, onDragOver, onRollOut, onDragOut, useHandCursor;
function JelloHitAreaMid () {
super();
_alpha = 0;
mc_debug = _root.createEmptyMovieClip("", _root.getNextHighestDepth());
enable();
}
function getController() {
return(_root.jello);
}
function _onRollOver() {
onMouseMove = _onMouseMove;
}
function _onRollOut() {
onMouseMove = null;
onMouseUp = null;
}
function _onMouseMove() {
var _local3 = new flash.geom.Point(_root._xmouse, _root._ymouse);
if (mouse_path.length <= 0) {
mouse_path = [_local3];
} else {
var _local5 = flash.geom.Point.distance(mouse_path[0], _local3);
if (_local5 > JelloConfig.mousespeed_detection_threshold) {
mouse_path.unshift(_local3);
if (getController().bool_debug) {
drawMousePath(mc_debug);
}
if (mouse_path.length > 1) {
var _local4 = Math.atan2(mouse_path[0].y - mouse_path[1].y, mouse_path[0].x - mouse_path[1].x);
if (_local4 < 0) {
_local4 = _local4 + Math.PI;
}
var _local6 = 0.392699081698724;
var _local7 = ["B", "C", "C", "A", "A", "D", "D", "B"][Math.floor(_local4 / _local6) % 8];
getController().onStartShake(_local7, 1);
}
} else {
mouse_orig = _local3;
mouse_path = [_local3];
}
}
}
function _onRelease() {
onMouseMove = null;
}
function enable(b) {
if (!(b === false)) {
onRollOver = (onDragOver = _onRollOver);
onRollOut = (onDragOut = _onRollOut);
useHandCursor = JelloConfig.use_hand_cursor;
} else {
onRollOver = (onDragOver = null);
onRollOut = (onDragOut = null);
onMouseUp = (onMouseMove = null);
useHandCursor = false;
}
}
function drawMousePath(canvas) {
canvas.clear();
canvas.lineStyle(2, 0, 100);
canvas.moveTo(mouse_path[0].x, mouse_path[0].y);
var _local2 = 1;
while (_local2 < mouse_path.length) {
canvas.lineTo(mouse_path[_local2].x, mouse_path[_local2].y);
_local2++;
}
}
}
Symbol 90 MovieClip [__Packages.JelloMain] Frame 0
class JelloMain
{
var target, tremor, tremor_length, tremor_endloop, tremor_endloop_length, tremor_fase, interval, tremor_dir, tremor_part, tremor_step, tremor_endloop_count, fade_step, tremor_endloops, sound, tremor_force;
function JelloMain (mc) {
target = mc;
target.stop();
}
function init() {
tremor = JelloConfig.tremor;
tremor_length = 0;
var _local2 = 0;
while (_local2 < tremor.length) {
tremor_length = tremor_length + tremor[_local2][1];
_local2++;
}
tremor_endloop = JelloConfig.tremor_endloop;
tremor_endloop_length = 0;
_local2 = 0;
while (_local2 < tremor_endloop.length) {
tremor_endloop_length = tremor_endloop_length + tremor_endloop[_local2][1];
_local2++;
}
tremor_fase = 0;
clearInterval(interval);
interval = setInterval(this, "step", 40);
target.gotoAndStop("0A");
if (JelloConfig.use_the_force) {
Mouse.addListener(this);
}
}
function step() {
if (tremor_fase == 1) {
var _local2 = tremor[tremor_part][0] + tremor_dir;
if (tremor[tremor_part][0] > 0) {
_local2 = "+" + _local2;
}
target.gotoAndStop(_local2);
tremor_step++;
if (tremor_step >= tremor[tremor_part][1]) {
tremor_part++;
tremor_step = 0;
if (tremor_part > tremor.length) {
tremor_part = 0;
tremor_step = -1;
tremor_endloop_count = 0;
tremor_fase = 2;
_local2 = tremor_endloop[0][0] + tremor_dir;
if (tremor_endloop[0][0] > 0) {
_local2 = "+" + _local2;
}
target.gotoAndStop(_local2);
fade_step = 100 / ((JelloConfig.endloop_sound_correction * tremor_endloop_length) * tremor_endloops);
fade_step = Math.max(Math.min(50, fade_step), 1);
}
}
}
if (tremor_fase == 2) {
tremor_step++;
if (tremor_step >= tremor_endloop[tremor_part][1]) {
tremor_part++;
tremor_step = 0;
if (tremor_part >= tremor_endloop.length) {
tremor_part = 0;
tremor_endloop_count++;
}
if (tremor_endloop_count >= tremor_endloops) {
tremor_fase = 0;
var _local2 = "0" + tremor_dir;
target.gotoAndStop(_local2);
return(undefined);
}
var _local2 = tremor_endloop[tremor_part][0] + tremor_dir;
if (tremor_endloop[tremor_part][0] > 0) {
_local2 = "+" + _local2;
}
target.gotoAndStop(_local2);
}
}
if (fade_step > 0) {
sound.setVolume(sound.getVolume() - fade_step);
if (sound.getVolume() <= 0) {
fade_step = 0;
sound.stop();
delete sound;
}
} else if (sound.getVolume() < 100) {
if (sound.getVolume() < 30) {
var _local3 = 100;
} else {
var _local3 = 20;
}
sound.setVolume(sound.getVolume() + _local3);
}
}
function startTremor(type, force, snd_offset) {
tremor_start = getTimer();
tremor_dir = type.toUpperCase();
tremor_force = force;
tremor_part = 0;
tremor_step = 0;
force = Math.max(Math.min(1 - JelloConfig.force_min, 1 - force), 0);
var _local4 = Math.floor(force * tremor_length);
var _local3 = 0;
var _local2 = 0;
while (_local2 < tremor.length) {
_local3 = _local3 + tremor[_local2][1];
if (_local3 > _local4) {
tremor_step = _local3 - _local4;
tremor_part = Math.max(0, _local2 - 1);
break;
}
_local2++;
}
tremor_endloops = Math.round(tremor_force * JelloConfig.endloops_factor);
stopAllSounds();
var _local5 = new SoundExt(target);
_local5.attachSound("main");
var cont = this;
_local5.onSoundComplete = function () {
cont.startEndSound();
};
_local5.setVolume(0);
var _local7 = ((snd_offset != undefined) ? (snd_offset / 1000) : ((_local5.duration * force) / 1000));
_local5.start(_local7);
sound = _local5;
fade_step = 0;
tremor_fase = 1;
}
function startEndSound() {
sound.setVolume(100);
sound.onSoundComplete = function () {
this.start(JelloConfig.loop_offset / 1000);
};
sound.start(JelloConfig.loop_offset / 1000);
}
function calcForce() {
if (!JelloConfig.use_the_force) {
return(1);
}
if (mouse_path.length < 2) {
return(0.5);
}
var _local3 = flash.geom.Point.distance(mouse_path[0], mouse_path[1]);
var _local2 = JelloConfig.force_map;
var _local4 = _local2[0] + ((Math.max(_local2[0], Math.min(_local2[1], _local3)) - _local2[0]) / (_local2[1] - _local2[0]));
return(_local4);
}
function onMouseMove() {
mouse_path.unshift(new flash.geom.Point(_root._xmouse, _root._ymouse));
if (mouse_path.length > 10) {
mouse_path = mouse_path.slice(0, 10);
}
}
function onStartShake(type, force) {
if ((getTimer() - tremor_start) > JelloConfig.time_between_starts) {
startTremor(type, calcForce(), JelloConfig.mid_sound_offset);
}
}
function onJelloHit(type) {
if (((getTimer() - tremor_start) > JelloConfig.time_between_starts) || (tremor_start == null)) {
startTremor(type, calcForce());
}
}
function onJelloOut(type) {
}
var tremor_start = -1000;
var mouse_path = [];
var bool_debug = false;
}
Symbol 91 MovieClip [__Packages.SoundExt] Frame 0
class SoundExt extends Sound
{
function SoundExt (trgt) {
super(trgt);
}
function setVolume(n) {
vol = n;
super.setVolume(n);
}
function getVolume() {
return(vol);
}
var framedur = 20;
var vol = 100;
var fade_durations = [1000, 1000];
var fade_cur = 0;
var playing = false;
static var FADE_IN = 1;
static var FADE_OUT = 2;
}