Frame 2
this.onEnterFrame = function () {
var _local4 = _root.getBytesTotal();
var _local3 = _root.getBytesLoaded();
percentage = ((!isNaN(_local3 / _local4)) ? (Math.ceil((_local3 * 100) / _local4)) : 0);
LoadBar._xscale = percentage;
if (percentage >= 99) {
delete this.onEnterFrame;
gotoAndPlay ("loaded");
}
};
stop();
Frame 6
var sw = 700;
var sh = 400;
var bg_color = 11442547;
var mainBmp = (new flash.display.BitmapData(sw, sh, true, bg_color));
this.createEmptyMovieClip("BG", this.getNextHighestDepth());
BG.beginFill(0, 100);
BG.lineTo(sw, 0);
BG.lineTo(sw, sh);
BG.lineTo(0, sh);
BG.lineTo(0, 0);
BG.endFill();
this.createEmptyMovieClip("Window", this.getNextHighestDepth());
Window.attachBitmap(mainBmp, 0);
artbit.swapDepths(5);
Snow.swapDepths(6);
colorPicker.swapDepths(7);
var shadow_dist = 10;
var undos = new Array();
var max_undo_levels = 6;
var i = 0;
while (i < max_undo_levels) {
var mc = Window.createEmptyMovieClip("undo" + i, i + 1);
mc.bmp = new flash.display.BitmapData(sw, sh, true, bg_color);
mc.createEmptyMovieClip("area", 1);
mc.attachBitmap(mc.bmp, 0);
undos.push(mc);
i++;
}
var canvas = undos[0];
this.createEmptyMovieClip("Buttons", this.getNextHighestDepth());
var btn_height = 20;
var btn_dist = 1;
Buttons.attachMovie("mc:Btn", "ToggleBtn", Buttons.getNextHighestDepth(), {ID:5});
Buttons.ToggleBtn.onClick = function () {
if (Buttons._x > -1) {
Buttons.onEnterFrame = function () {
var _local2 = (-75 - this._x) / 4;
this._x = this._x + _local2;
this.ToggleBtn._x = this.ToggleBtn._x + ((36 - this.ToggleBtn._x) / 4);
if (Math.abs(_local2) < 0.05) {
delete this.onEnterFrame;
}
};
} else {
this._x = 0;
Buttons.onEnterFrame = function () {
var _local2 = (75 - this._x) / 4;
this._x = this._x + _local2;
if (Math.abs(_local2) < 0.05) {
delete this.onEnterFrame;
}
};
}
};
Buttons.ToggleBtn._y = -3;
Buttons.attachMovie("mc:Btn", "OrnamentBtn", Buttons.getNextHighestDepth(), {ID:1});
Buttons.OrnamentBtn.onClick = function () {
addOrnament();
};
Buttons.OrnamentBtn._y = btn_height + btn_dist;
Buttons.attachMovie("mc:Btn", "BGColor", Buttons.getNextHighestDepth(), {ID:3});
Buttons.BGColor.onClick = function () {
colorPicker._y = 5;
};
Buttons.BGColor._y = 2 * (btn_height + btn_dist);
Buttons.attachMovie("mc:Btn", "ClearAll", Buttons.getNextHighestDepth(), {ID:10, count:0});
Buttons.ClearAll.resetMe = function () {
count = 0;
this.Icon.gotoAndStop(10 + count);
trace(myID);
clearInterval(myID);
};
Buttons.ClearAll.onClick = function () {
clearInterval(myID);
if ((++count) > 2) {
_root.clearAll();
count = 0;
}
myID = setInterval(this, "resetMe", 3000);
this.Icon.gotoAndStop(10 + count);
};
Buttons.ClearAll._y = 3 * (btn_height + btn_dist);
Buttons.attachMovie("mc:Btn", "BlurBtn", Buttons.getNextHighestDepth(), {ID:2});
Buttons.BlurBtn.onClick = function () {
_root.BlurImage();
};
Buttons.BlurBtn._y = 4 * (btn_height + btn_dist);
Buttons.attachMovie("mc:Btn", "UndoBtn", Buttons.getNextHighestDepth(), {ID:4});
Buttons.UndoBtn.onClick = function () {
_root.doUndo();
};
Buttons.UndoBtn._y = 5 * (btn_height + btn_dist);
Buttons.attachMovie("mc:Btn", "PrintBtn", Buttons.getNextHighestDepth(), {ID:6});
Buttons.PrintBtn.onClick = function () {
_root.printThis(_root.Window);
};
Buttons.PrintBtn._y = 6 * (btn_height + btn_dist);
Buttons._x = 75;
Buttons._y = 15;
var x = 270;
var y = 200;
var vx = 0;
var vy = 0;
var damp = 0.9;
var angle = 0;
var va = 0;
var count = 0;
var mousePressed = false;
var pt = new Object({x:0, y:0});
var delay_start = true;
var MODE = "paint";
var klisten = new Object();
klisten.onKeyDown = function () {
switch (Key.getAscii()) {
case 112 :
printThis();
case 98 :
BlurImage();
break;
case 117 :
doUndo();
break;
case 111 :
addOrnament();
break;
case 16 :
is_SHIFT_down = true;
break;
case 100 :
trace("DELETE");
mainBmp.fillRect(new flash.geom.Rectangle(0, 0, sw, sh), 0);
var _local1 = 0;
for(;;){
if (_local1 >= max_undo_levels) {
break;
}
var _local2 = undos[_local1];
_local2.clear();
_local2.bmp.fillRect(new flash.geom.Rectangle(0, 0, sw, sh), 0);
_local1++;
};
}
};
clearAll = function () {
var _local2 = max_undo_levels;
while (_local2--) {
var _local1 = undos[_local2];
plotAndRemoveAllOrnaments(_local1);
_local1.clear();
_local1.bmp.fillRect(new flash.geom.Rectangle(0, 0, sw, sh), 0);
}
mainBmp.fillRect(new flash.geom.Rectangle(0, 0, sw, sh), 0);
};
plotAndRemoveAllOrnaments = function (mc) {
for (i in mc) {
var _local1 = mc[i];
if (typeof(_local1) == "movieclip") {
if (_local1.isOrnament) {
_local1.Ball.Navigation.Hide();
var _local2 = new flash.geom.Matrix();
_local2.translate(_local1._x, _local1._y);
mc.bmp.draw(_local1, _local2);
_local1.removeMovieClip();
}
}
}
};
Key.addListener(klisten);
mouseDowner = function () {
pt.x = _root._xmouse;
pt.y = _root._ymouse;
mousePressed = true;
delay_start = true;
};
BG.onMouseDown = mouseDowner;
onMouseUp = function () {
mousePressed = false;
_root.MODE = "paint";
};
processUndos = function () {
var _local1 = undos.pop();
plotAndRemoveAllOrnaments(_local1, mainBmp);
mainBmp.draw(_local1);
_local1.bmp.fillRect(new flash.geom.Rectangle(0, 0, sw, sh), 0);
_local1.clear();
_local1.swapDepths(Window.getNextHighestDepth());
undos.splice(0, 0, _local1);
canvas = undos[0];
};
onEnterFrame = function () {
if ((!mousePressed) || (MODE != "paint")) {
return(undefined);
}
var _local8 = _root._xmouse - pt.x;
var _local7 = _root._ymouse - pt.y;
angle = Math.atan2(_local7, _local8);
var _local9 = Math.sqrt((_local8 * _local8) + (_local7 * _local7));
if (delay_start && (_local9 < 5)) {
return(undefined);
}
if (delay_start) {
processUndos();
}
if (_local9 > 5) {
pt.x = _root._xmouse;
pt.y = _root._ymouse;
}
delay_start = false;
vx = Math.cos(angle) * 5;
vy = Math.sin(angle) * 5;
x = _root._xmouse + vx;
y = _root._ymouse + vy;
var _local4 = 0;
while (_local4 < 6) {
var _local2 = canvas.area;
_local2.moveTo(x + shadow_dist, y + shadow_dist);
var _local5 = Math.random() * 255;
var _local6 = _local5 << 8;
var _local3 = (angle + (Math.random() * 1)) - 0.5;
_local2.lineStyle(2, 0, 10);
_local2.lineTo((x - (Math.cos(_local3) * 30)) + shadow_dist, (y - (Math.sin(_local3) * 30)) + shadow_dist);
_local2.moveTo(x, y);
_local2.lineStyle(1, _local6, 100);
_local2.lineTo(x - (Math.cos(_local3) * 30), y - (Math.sin(_local3) * 30));
_local4++;
}
canvas.bmp.draw(canvas.area);
canvas.area.clear();
};
MovieClip.prototype.startScale = function () {
scaley = _ymouse;
this.onEnterFrame = function () {
var _local3 = _ymouse - scaley;
var _local2 = this._xscale * (1 + (_local3 / 200));
this._xscale = (this._yscale = _local2);
scaley = _ymouse;
};
};
changeColor = function (col) {
var _local1 = new Color(BG);
_local1.setRGB(col);
};
BlurImage = function () {
var _local2 = max_undo_levels;
while (_local2--) {
var _local1 = undos[_local2];
plotAndRemoveAllOrnaments(_local1);
mainBmp.draw(_local1);
_local1.clear();
_local1.bmp.fillRect(new flash.geom.Rectangle(0, 0, sw, sh), 0);
}
mainBmp.applyFilter(mainBmp, mainBmp.rectangle, new flash.geom.Point(0, 0), new flash.filters.BlurFilter(2, 2, 1));
};
doUndo = function () {
var _local1 = undos.shift();
trace(_local1);
_local1.clear();
_local1.bmp.fillRect(new flash.geom.Rectangle(0, 0, sw, sh), 0);
_local1.swapDepths(1);
undos.push(_local1);
canvas = undos[0];
};
printThis = function () {
printAsBitmap (_root.Window, "bmovie");
};
addOrnament = function () {
_root.MODE = "ornament";
var _local2 = _root.canvas.getNextHighestDepth();
var tmp = _root.canvas.attachMovie("mc:Ornament", "Ornament" + _local2, _local2);
tmp.isOrnament = true;
tmp._x = _root._xmouse;
tmp._y = _root._ymouse + 80;
startDrag (tmp.dragger);
_root.onMouseDown = function () {
tmp.dragger.stopDrag();
_root.onMouseDown = _root.mouseDowner;
};
};
processUndos();
stop();
Instance of Symbol 54 MovieClip "Light" in Frame 6
/* no clip actions */
Symbol 12 MovieClip Frame 1
stop();
Symbol 14 Button
on (rollOver) {
this._alpha = 80;
}
on (rollOut, releaseOutside) {
this._alpha = 100;
}
on (release) {
onClick();
}
Symbol 15 MovieClip [mc:Btn] Frame 1
Icon.gotoAndStop(ID);
stop();
Symbol 27 MovieClip Frame 1
Prev = function () {
var _local2 = this._currentframe;
var _local3 = this._totalframes;
_local2--;
if (!_local2) {
_local2 = _local3;
}
this.gotoAndStop(_local2);
};
Next = function () {
var _local2 = this._currentframe;
var _local3 = this._totalframes;
_local2++;
if (_local2 > _local3) {
_local2 = 1;
}
this.gotoAndStop(_local2);
};
Symbol 31 MovieClip Frame 2
stop();
Symbol 33 Button
on (rollOver) {
if ((_root.MODE == "paint") && (_root.mousePressed)) {
return(undefined);
}
if (!is_visible) {
gotoAndPlay ("show");
}
}
Symbol 38 Button
on (press) {
_root.MODE = "ornament";
started_at = getTimer();
trace("Klikac");
}
on (release) {
this._parent.Ornament.Type.Next();
}
on (rollOver) {
started_at = getTimer();
}
Symbol 39 Button
on (release) {
_root.MODE = "ornament";
this._parent.Ornament.Type.Prev();
started_at = getTimer();
}
on (rollOver) {
started_at = getTimer();
}
on (press) {
_root.MODE = "ornament";
}
Symbol 40 MovieClip Frame 1
stop();
var delay = 3000;
var started_at = getTimer();
var intervalID;
var is_visible = false;
delayedFade = function () {
if ((started_at + delay) < getTimer()) {
gotoAndPlay ("hide");
clearInterval(intervalID);
}
};
Hide = function () {
clearInterval(intervalID);
this.gotoAndStop(1);
};
Symbol 40 MovieClip Frame 10
stop();
is_visible = true;
started_at = getTimer();
clearInterval(intervalID);
intervalID = setInterval(delayedFade, 100);
Instance of Symbol 37 MovieClip in Symbol 40 MovieClip Frame 10
on (press) {
_root.MODE = "ornament";
this._parent._parent.startScale();
trace(this._parent._parent._parent);
clearInterval(_parent.intervalID);
}
on (release, releaseOutside) {
delete this._parent._parent.onEnterFrame;
_parent.started_at = getTimer();
_parent.intervalID = setInterval(_parent.delayedFade, 100);
}
Symbol 40 MovieClip Frame 15
is_visible = false;
gotoAndStop (2);
Symbol 41 MovieClip Frame 1
Ornament.Type.gotoAndStop(type);
Instance of Symbol 31 MovieClip "Ornament" in Symbol 41 MovieClip Frame 1
onClipEvent (enterFrame) {
var lightSource = new Object({x:_root.Light._x, y:_root.Light._y});
this.globalToLocal(lightSource);
var x = lightSource.x;
var y = (-1 * lightSource.y);
var angle = ((Math.atan2(y, x) * 180) / Math.PI);
lightshell._rotation = -angle;
lightdist = Math.sqrt((x * x) + (y * y));
var max_radius = 30;
lightshell.shadow._x = (((-max_radius) * max_radius) / (lightdist + max_radius)) + max_radius;
with (lightshell.shadow) {
_xscale = 100 - ((_x * _x) / 25);
}
}
Symbol 43 Button
on (press) {
_root.MODE = "ornament";
startDrag (_target);
}
on (release, releaseOutside) {
stopDrag();
}
Symbol 46 MovieClip [mc:Ornament] Frame 1
var A = (new flash.geom.Point());
var B = (new flash.geom.Point());
var va = (new flash.geom.Point());
var vb = (new flash.geom.Point());
var rope_len = 10;
this.onEnterFrame = function () {
var _local2 = dragger._x - A.x;
var _local5 = dragger._y - A.y;
var _local4 = _local2 / 2;
var _local3 = _local5;
va.x = va.x + _local4;
va.y = va.y + _local3;
A.x = A.x + (va.x + _local4);
A.y = A.y + (va.y + _local3);
var _local1 = (-_local2) / 50;
tip._x = dragger._x + (Math.sin(_local1) * rope_len);
tip._y = A.y + (Math.cos(_local1) * rope_len);
_local2 = tip._x - B.x;
_local5 = tip._y - B.y;
_local4 = _local2 / 10;
_local3 = _local5 / 3;
vb.x = vb.x + _local4;
vb.y = vb.y + _local3;
B.x = (B.x + vb.x) + _local4;
B.y = (B.y + vb.y) + _local3;
_local1 = (-_local2) / 200;
Ball._x = tip._x + (Math.sin(_local1) * Ball.radius);
Ball._y = B.y + (Math.cos(_local1) * Ball.radius);
Ball._rotation = (-_local1) * 50;
};
stop();
Instance of Symbol 41 MovieClip "Ball" in Symbol 46 MovieClip [mc:Ornament] Frame 1
onClipEvent (load) {
this.radius = 50;
this.type = 2;
}
Instance of Symbol 58 MovieClip "colors" in Symbol 61 MovieClip Frame 1
on (press) {
srcMC = this;
var colorBitmap = (new flash.display.BitmapData(srcMC._width, srcMC._height, true, 0));
colorBitmap.draw(srcMC);
var bg_color = ("0x" + colorBitmap.getPixel(srcMC._xmouse, srcMC._ymouse).toString(16));
_root.changeColor(bg_color);
this._parent._y = -150;
delete this.onEnterFrame;
}
onClipEvent (enterFrame) {
srcMC = this;
var colorBitmap = (new flash.display.BitmapData(srcMC._width, srcMC._height, true, 0));
colorBitmap.draw(srcMC);
var bg_color = ("0x" + colorBitmap.getPixel(srcMC._xmouse, srcMC._ymouse).toString(16));
var col = new Color(this._parent.CurrentColor);
col.setRGB(bg_color);
}