Combined Code
frame 1 {
function randRange(min, max) {
var v1 = Math.floor(Math.random() * (max - min + 1)) + min;
return v1;
}
function playSound(which) {
var v2 = new Sound(this);
v2.attachSound('noise' + (which || 4));
v2.start();
}
function playAnim(emote) {
crabbyEyes.gotoAndPlay(emote);
trace(emotes[currentEmote]);
}
function getHat(whichHat) {
if (!whichHat) {
if (randomHat) {
whichHat = _root.randRange(1, crabbyHat._totalframes);
if (whichHat == crabbyHat._currentframe) {
whichHat = (whichHat == crabbyHat._totalframes) ? 1 : whichHat + 1;
}
} else {
if (crabbyHat._currentframe == crabbyHat._totalframes) {
whichHat = 1;
} else {
whichHat = crabbyHat._currentframe + 1;
}
}
}
crabbyHat.gotoAndStop(whichHat);
}
emotes = ['normal', 'angry', 'sorry', 'surprised', 'inquisitive'];
currentEmote = 0;
randomHat = true;
crabby.onMouseUp = function () {
getHat();
};
flash.external.ExternalInterface.addCallback('playAnim', this, playAnim);
flash.external.ExternalInterface.addCallback('playSound', this, playSound);
}
movieClip 6 {
}
movieClip 69 {
frame 1 {
_root.crabbyHat = this;
stop();
}
}
movieClip 72 {
}
movieClip 75 {
}
movieClip 78 {
}
movieClip 81 {
}
movieClip 84 {
}
movieClip 87 {
}
movieClip 88 {
frame 1 {
_root.crabbyEyes = this;
}
frame 121 {
gotoAndPlay('normal');
}
frame 138 {
stop();
}
frame 161 {
stop();
}
frame 186 {
stop();
}
frame 211 {
stop();
}
}
movieClip 89 {
}
movieClip 150 {
}
movieClip 151 {
frame 1 {
cmask.cacheAsBitmap = true;
eyes.cacheAsBitmap = true;
eyes.setMask(cmask);
}
}
movieClip 152 {
}
movieClip 153 {
}