[Tools][Expand/Collapse All]Note that automatic extraction of ActionScript 3 is still pretty much unsupported by swfchan. AS1/AS2 works okay most of the time.Frame 1 (9.54 KiB) ● ●
function setState(str) {
if (state == str) {
return(undefined);
}
for (i in states[str]) {
curState[i] = states[str][i];
}
curState.state = (state = str);
houndour.head.mouth.gotoAndPlay(curState.mouth);
houndour.head.eye.gotoAndPlay(curState.eye);
houndour.head.eye.pupil._x = pX + curState.pX;
houndour.head.eye.pupil._y = pY + curState.pY;
houndour.head.onEnterFrame = function () {
var _local2 = 4;
if (Math.abs(this._rotation - curState._rotation) <= _local2) {
this._rotation = curState._rotation;
delete this.onEnterFrame;
} else if (this._rotation < curState._rotation) {
this._rotation = this._rotation + _local2;
} else {
this._rotation = this._rotation - _local2;
}
};
}
function moveArm(str) {
if (houndour.arm._currentlabel != str) {
houndour.arm.gotoAndPlay("move" + str);
}
}
function setSize(s) {
s = Math.floor(s);
houndour.belly.gotoAndStop(s);
}
function popRate(s) {
var _local2 = Number(size - minSize) / Number(maxSize - minSize);
var _local1 = 1 - (Math.abs(0.5 - _local2) * 2);
return(Math.max(_local1, 0.01));
}
function popcorn() {
if (Math.random() < popRate(size)) {
size++;
if (size == maxSize) {
houndour.reset_btn.vY = 10;
houndour.reset_btn.onEnterFrame = function () {
this._y = this._y + this.vY;
this.vY = this.vY + 2;
if (this._y >= origRY) {
this._y = origRY;
delete this.onEnterFrame;
}
};
}
setSize(size);
var _local6 = Number(size - minSize) / Number(maxSize - minSize);
var _local4 = getMidValue(_local6, initOpening, endOpening);
var frames = (8 + (Math.floor(Math.random() * 8) * 2));
var _local5 = Math.floor(Math.random() * 20) + 10;
var _local8 = ((Math.random() * _local4) - (_local4 * 0.5)) - (Math.PI/2);
var _local9 = ((Math.random() * _local4) - (_local4 * 0.5)) - (Math.PI/2);
var _local10 = 0;
var _local2 = overBelly.createEmptyMovieClip("popCircle" + overBelly.getNextHighestDepth(), overBelly.getNextHighestDepth());
var _local3 = underBelly.createEmptyMovieClip("popCircle2_" + underBelly.getNextHighestDepth(), underBelly.getNextHighestDepth());
_local2.beginFill(16658195);
drawCircle(_local2, 0, 0, _local5);
_local2.endFill();
_local3.lineStyle(1, 1);
drawCircle(_local3, 0, 0, _local5);
_local2._rotation = Math.random() * 360;
_local3._rotation = _local2._rotation;
_local2.dist = 0;
_local2.angle1 = _local8;
_local2.angle2 = _local9;
_local2.frame0 = 0;
_local2.frames = frames;
_local2.circle2 = _local3;
_local2.onEnterFrame = function () {
if (this.frame0 < this.frames) {
var _local2 = this.frame0 / this.frames;
var _local5 = getMidValue(_local2, this.angle1, this.angle2);
var _local4 = Math.abs(1 - (_local2 * 2));
var _local3 = setPos(_local5, _local4);
this._x = _local3._x;
this._y = _local3._y;
this.circle2._x = this._x;
this.circle2._y = this._y;
this.frame0++;
} else {
delete this.onEnterFrame;
this.circle2.removeMovieClip();
this.removeMovieClip();
}
};
}
}
function drawCircle(mc, x, y, r) {
mc.moveTo(x + r, y);
mc.curveTo(r + x, (0.414213562373095 * r) + y, (0.707106781186547 * r) + x, (0.707106781186547 * r) + y);
mc.curveTo((0.414213562373095 * r) + x, r + y, x, r + y);
mc.curveTo((-0.414213562373095 * r) + x, r + y, (-0.707106781186547 * r) + x, (0.707106781186547 * r) + y);
mc.curveTo((-r) + x, (0.414213562373095 * r) + y, (-r) + x, y);
mc.curveTo((-r) + x, (-0.414213562373095 * r) + y, (-0.707106781186547 * r) + x, (-0.707106781186547 * r) + y);
mc.curveTo((-0.414213562373095 * r) + x, (-r) + y, x, (-r) + y);
mc.curveTo((0.414213562373095 * r) + x, (-r) + y, (0.707106781186547 * r) + x, (-0.707106781186547 * r) + y);
mc.curveTo(r + x, (-0.414213562373095 * r) + y, r + x, y);
}
function getMidValue(pos, min, max) {
return(min + (pos * Number(max - min)));
}
function setPos(angle, dist) {
var _local1 = Number(size - minSize) / Number(maxSize - minSize);
var _local10 = getMidValue(_local1, initXDist, endXDist);
var _local9 = getMidValue(_local1, initYDist, endYDist);
var _local6 = getMidValue(_local1, initCenterX, endCenterX);
var _local5 = getMidValue(_local1, initCenterY, endCenterY);
var _local2 = getMidValue(_local1, initAngle, endAngle);
var _local4 = ((Math.cos(angle) * _local10) * dist) * 0.9;
var _local3 = ((Math.sin(angle) * _local9) * dist) * 0.9;
var _local7 = (_local4 * Math.cos(_local2)) - (_local3 * Math.sin(_local2));
var _local8 = (_local3 * Math.cos(_local2)) + (_local4 * Math.sin(_local2));
return({_x:(houndour.belly._x + _local6) + _local7, _y:(houndour.belly._y + _local5) + _local8});
}
function makePopcorn() {
var _local2 = houndour.createEmptyMovieClip("popcorn" + houndour.getNextHighestDepth(), houndour.getNextHighestDepth());
_local2._x = ((houndour.popcorn._x - 32) + (Math.random() * 20)) - 10;
_local2._y = houndour.popcorn._y + 59;
_local2.vY = 2;
_local2.beginFill(16768341);
_local2.curveTo(-3, 3, 0, 4);
_local2.curveTo(3, 3, 0, 0);
_local2.endFill();
_local2.onEnterFrame = function () {
this.vY = this.vY + 5;
if (this._y > ((houndour.head._y + houndour.head.mouth._y) + houndour.head.mouth._height)) {
delete this.onEnterFrame;
this.removeMovieClip();
return(undefined);
}
if (this.hitTest(houndour.head.mouth)) {
if (size < minSize) {
size++;
eating = 5;
setSize(size);
if (size == minSize) {
houndour.popcorn.gotoAndPlay(2);
}
}
delete this.onEnterFrame;
this.removeMovieClip();
return(undefined);
}
this._y = this._y + this.vY;
};
}
function reset() {
houndour.reset_btn._y = origRY - 100;
size = 1;
setSize(1);
waitForIt = 40;
eating = 0;
ready = false;
state = "";
setState("normal");
moveArm("down");
houndour.popcorn.gotoAndStop(1);
}
var lcd_stolen = new LocalConnection().domain();
if (lcd_stolen.indexOf("deviantart") == -1) {
var stolen_mc = _root.createEmptyMovieClip("stolen_mc", _root.getNextHighestDepth());
stolen_mc.createTextField("stolen_txt", 10000, 0, 0, 800, 600);
var stolen_txt = stolen_mc.stolen_txt;
stolen_txt.background = true;
stolen_txt.wordWrap = true;
stolen_txt.multiline = true;
stolen_txt.backgroundColor = 16777215 /* 0xFFFFFF */;
stolen_txt.selectable = false;
var tF = new TextFormat();
tF.size = 32;
tF.color = 16711680 /* 0xFF0000 */;
tF.font = "Arial";
tF.bold = true;
tF.align = "center";
stolen_txt.setNewTextFormat(tF);
stolen_txt.text = ("Warning: you are playing this file on\n" + lcd_stolen) + "\n\nBest go to\nhttp://doom-the-wolf.deviantart.com\n to see the original.\n\nClick to close.";
stolen_mc.onMouseDown = (stolen_mc.onPress = function () {
delete this.onMouseDown;
delete this.onPress;
this.removeMovieClip();
});
}
var size = 1;
var maxSize = 400;
var minSize = 200;
var state = "";
var condition = "";
var curState = {};
var states = {};
var eating = 0;
var waitForIt = 40;
var rumble = 0;
var rumbleFreq = 2.51327412287183;
var bY = houndour.belly._y;
var bX = houndour.belly._x;
var pX = houndour.head.eye.pupil._x;
var pY = houndour.head.eye.pupil._y;
states.normal = {mouth:"normal", eye:"open", _rotation:0, pX:0, pY:0};
states.eating = {mouth:"eating", eye:"happy", _rotation:-10, pX:0, pY:0};
states.surprised = {mouth:"confused", eye:"sad", _rotation:14, pX:12, pY:8};
states.surprised2 = {mouth:"open", eye:"sad", _rotation:14, pX:12, pY:8};
states.tired = {mouth:"open", eye:"small", _rotation:8, pX:10, pY:6};
states.happy = {mouth:"smile", eye:"closed", _rotation:14, pX:0, pY:0};
var origRY = houndour.reset_btn._y;
houndour.reset_btn._y = houndour.reset_btn._y - 100;
setState("normal");
setSize(1);
houndour.onEnterFrame = function () {
if (((houndour.popcorn._currentframe > 1) && (size > minSize)) && (size < maxSize)) {
rumble = rumble + rumbleFreq;
houndour.belly._x = bX + (Math.sin(rumble) * 0.1);
houndour.belly._y = bY + (Math.cos(rumble) * 0.5);
if (size < (minSize + ((maxSize - minSize) * 0.5))) {
setState("surprised");
} else {
setState("surprised2");
}
moveArm("up");
} else if (size == minSize) {
setState("happy");
moveArm("down");
} else if (size == maxSize) {
setState("tired");
moveArm("down");
} else if (!eating) {
setState("normal");
}
if (size < (minSize * 0.75)) {
moveArm("down");
} else if (size < minSize) {
moveArm("up");
}
if (eating) {
var _local1 = curState.state;
setState("eating");
curState.state = _local1;
eating--;
if (!eating) {
setState(curState.state);
}
}
if (!ready) {
if (houndour.popcorn._currentframe == houndour.popcorn._totalframes) {
ready = true;
}
} else if (size < maxSize) {
if (!waitForIt) {
popcorn();
} else {
waitForIt--;
}
}
};
var initCenterX = 34;
var initCenterY = 6;
var initAngle = 0.577901936962246;
var initXDist = 82;
var initYDist = 65;
var initOpening = Math.PI;
var endCenterX = 68;
var endCenterY = -85;
var endAngle = 0.548240569847623;
var endXDist = 153;
var endYDist = 140;
var endOpening = 4.71238898038469;
var underBelly = houndour.createEmptyMovieClip("underbelly", houndour.body.getDepth() - 1);
var overBelly = houndour.createEmptyMovieClip("overbelly", houndour.belly.getDepth() + 1);
houndour.popcorn.onPress = function () {
this.onEnterFrame = function () {
if (size < minSize) {
makePopcorn();
}
};
this.onMouseUp = function () {
delete this.onEnterFrame;
};
};
houndour.reset_btn.onPress = reset;
Symbol 7 MovieClip Frame 1 (8 B)
stop();
Symbol 7 MovieClip Frame 20 (8 B)
stop();
Symbol 46 MovieClip Frame 1 (24 B)
_currentlabel = "open";
Symbol 46 MovieClip Frame 2 (8 B)
stop();
Symbol 46 MovieClip Frame 3 (26 B)
_currentlabel = "closed";
Symbol 46 MovieClip Frame 4 (8 B)
stop();
Symbol 46 MovieClip Frame 5 (25 B)
_currentlabel = "small";
Symbol 46 MovieClip Frame 6 (8 B)
stop();
Symbol 46 MovieClip Frame 7 (25 B)
_currentlabel = "blink";
Symbol 46 MovieClip Frame 11 (28 B)
_currentlabel = "endblink";
Symbol 46 MovieClip Frame 12 (8 B)
stop();
Symbol 46 MovieClip Frame 15 (25 B)
_currentlabel = "happy";
Symbol 46 MovieClip Frame 16 (8 B)
stop();
Symbol 46 MovieClip Frame 17 (23 B)
_currentlabel = "sad";
Symbol 46 MovieClip Frame 29 (21 B)
gotoAndPlay ("sad");
Symbol 60 MovieClip Frame 1 (26 B)
_currentlabel = "normal";
Symbol 60 MovieClip Frame 2 (8 B)
stop();
Symbol 60 MovieClip Frame 3 (26 B)
_currentlabel = "eating";
Symbol 60 MovieClip Frame 10 (24 B)
gotoAndPlay ("eating");
Symbol 60 MovieClip Frame 11 (28 B)
_currentlabel = "confused";
Symbol 60 MovieClip Frame 12 (8 B)
stop();
Symbol 60 MovieClip Frame 13 (24 B)
_currentlabel = "open";
Symbol 60 MovieClip Frame 14 (8 B)
stop();
Symbol 60 MovieClip Frame 15 (25 B)
_currentlabel = "smile";
Symbol 60 MovieClip Frame 16 (8 B)
stop();
Symbol 72 MovieClip Frame 1 (24 B)
_currentlabel = "down";
Symbol 72 MovieClip Frame 2 (8 B)
stop();
Symbol 72 MovieClip Frame 15 (22 B)
_currentlabel = "up";
Symbol 72 MovieClip Frame 20 (22 B)
_currentlabel = "up";
Symbol 72 MovieClip Frame 21 (8 B)
stop();
Symbol 72 MovieClip Frame 22 (24 B)
_currentlabel = "down";
Symbol 72 MovieClip Frame 27 (22 B)
gotoAndPlay ("down");