Frame 1
_root.NewgroundsAPI_id = 3714;
var fSize:Number;
var bLoded:Number;
fSize = _root.getBytesTotal();
var per:Number;
per = 0;
var time1:Number;
time1 = 20;
Frame 2
bLoded = _root.getBytesLoaded();
per = Math.round(bLoded / fSize) * 100;
with (_root.loadMC) {
_x = 100;
_y = 150;
_height = 20;
_width = 300;
with (_root.loadMC.barMC) {
_height = 20;
_width = per * 3;
}
}
Frame 5
if (per < 98) {
gotoAndPlay (2);
} else {
gotoAndPlay (6);
}
Frame 7
stop();
btn.onRelease = function () {
nextFrame();
};
Frame 8
function clean() {
inVal = "Your messege here...";
outVal = "Your encoded / decoded messege will be here";
code = "";
inBox.text = inVal;
outBox.text = outVal;
codeBox.text = code;
}
function passCode() {
var string1:String;
string1 = "";
var codeNum:Number;
codeNum = 0;
string1 = codeBox.text;
string1.toString();
if (string1 == "") {
string2 = e1;
} else {
var codeLength:Number;
codeLength = string1.length;
codeLength--;
i = 0;
while (!(i === codeLength)) {
codeNum = codeNum + string1.charCodeAt(i);
i++;
}
code = codeNum;
}
}
function encode() {
inVal = inBox.text;
var msgLength:Number;
if (inVal == "") {
outVal = e2;
} else if (inVal == "Your messege here...") {
outVal = e2;
} else {
outVal = "";
msgLength = inVal.length;
msgLength--;
i = 0;
while (i < msgLength) {
var v1;
var v2:Number;
v1 = inVal.charCodeAt(i);
v2 = v1 + code;
var v3:String;
v3 = String.fromCharCode(v2);
outVal = outVal + v3;
i++;
}
}
outBox.text = outVal;
}
function decode() {
inVal = inBox.text;
var msgLength:Number;
if (inVal == "") {
outVal = e2;
} else if (inVal == "Your messege here...") {
outVal = e2;
} else {
outVal = "";
msgLength = inVal.length;
msgLength--;
i = 0;
while (i < msgLength) {
var v1;
var v2:Number;
v1 = inVal.charCodeAt(i);
v2 = v1 - code;
var v3:String;
v3 = String.fromCharCode(v2);
outVal = outVal + v3;
i++;
}
}
outBox.text = outVal;
}
stop();
var c1;
var c2;
var c3:Color;
c1 = new Color(inBox);
c2 = new Color(outBox);
c3 = new Color(codeBox);
c1 = 16777113 /* 0xFFFF99 */;
c2 = 10092441 /* 0x99FF99 */;
c3 = 16751001 /* 0xFF9999 */;
inBox.backgroundColor = c1;
outBox.backgroundColor = c2;
codeBox.backgroundColor = c3;
var inVal:String;
var outVal:String;
var code:String;
var e1;
var e2;
var e3:String;
e1 = "No PASS_CODE found ! (try to re-enter pass)";
e2 = "No messege to ENCODE !";
e2 = "No messege to DECODE !";
clean();
encodeBtn.onRelease = function () {
passCode();
encode();
};
decodeBtn.onRelease = function () {
passCode();
decode();
};
clearBtn.onRelease = function () {
clean();
};
helpBtn.onRelease = function () {
gotoAndStop (7);
};
Symbol 20 Button
on (release) {
_root.NewgroundsAPI_loadMyMovie();
}
Symbol 25 Button
on (release) {
_root.NewgroundsAPI_loadMyMovie();
}
Symbol 28 Button
on (release) {
this._visible = false;
}
Symbol 30 MovieClip Frame 1
_visible = false;
_root.NewgroundsAPI = this;
STAT_MOVIE_VIEWS = 1;
STAT_AUTHOR_SITE = 2;
STAT_NEWGROUNDS = 3;
STAT_NEW_VERSION = 4;
STAT_CUSTOM_STATS = 50;
Symbol 30 MovieClip Frame 2
_root.NewgroundsAPI.POPUP_ERROR._visible = false;
_root.NewgroundsAPI.POPUP_VERSION._visible = false;
customStats = new Object();
i = 1;
while (i < _root.NewgroundsAPI_customLinks.length) {
customStats[_root.NewgroundsAPI_customLinks[i]] = i + STAT_CUSTOM_STATS;
i++;
}
i = 1;
while (i < _root.NewgroundsAPI_customEvents.length) {
customStats[_root.NewgroundsAPI_customEvents[i]] = i + STAT_CUSTOM_STATS;
i++;
}
_x = 0;
_y = 0;
configureMovie = function () {
if (_root.NewgroundsAPI_params.error != undefined) {
sendError(_root.NewgroundsAPI_params.error);
}
if (_root.NewgroundsAPI_params.settings_loaded == 1) {
sendMessage("You have successfully connected to the Newgrounds API gateway!");
sendMessage(("Movie Identified as '" + _root.NewgroundsAPI_params.movie_name) + "'");
}
if (_root.NewgroundsAPI_params.deny_host == 1) {
sendMessage(host + " is not approved to use this movie");
_root.NewgroundsAPI_onDenyHost(host, _root.NewgroundsAPI_params.movie_url, (script_url + "&stat=") + STAT_NEW_VERSION);
}
if (_root.NewgroundsAPI_params.movie_version == 1) {
sendMessage(("Version " + _root.NewgroundsAPI_params.movie_version) + " is now available!");
_root.NewgroundsAPI_onNewVersionAvailable(_root.NewgroundsAPI_params.movie_version, _root.NewgroundsAPI_params.movie_url, (script_url + "&stat=") + STAT_NEW_VERSION);
}
if (_root.NewgroundsAPI_params.ad_url != undefined) {
sendMessage("This movie has been approved to use Flash Ads");
_root.NewgroundsAPI_onAdsApproved(_root.NewgroundsAPI_params.ad_url);
}
};
sendError = function (error) {
};
sendMessage = function (message) {
};
sendStats = function (stat, new_window) {
if (script_url != undefined) {
query = "&stat=" + stat;
if (new_window == true) {
getURL (script_url + query, "_blank");
} else {
initInfo = new XML();
initInfo.onLoad = function () {
i = 0;
while (i < this.childNodes.length) {
if (this.childNodes[i].nodeName != null) {
j = 0;
while (j < this.childNodes[i].childNodes.length) {
if (this.childNodes[i].childNodes[j].nodeName != null) {
param_name = this.childNodes[i].childNodes[j].nodeName;
param_value = unescape(this.childNodes[i].childNodes[j].attributes.value);
_root.NewgroundsAPI_params[param_name] = param_value;
}
j++;
}
}
i++;
}
_root.NewgroundsAPI.configureMovie();
};
initInfo.load(script_url + query);
}
}
};
host = _url.split("/")[2].toLowerCase();
if (host.length < 1) {
host = "localhost";
}
if (!_root.NewgroundsAPI_id) {
sendError("Missing required '_root.NewgroundsAPI_id' variable");
} else if (!tracker_id) {
tracker_id = _root.NewgroundsAPI_id;
script_url = (("http://www.ngads.com/gateway.php?id=" + tracker_id) + "&host=") + escape(host);
_root.NewgroundsAPI_params = new Object();
sendMessage("Connecting to API gateway...");
sendStats(STAT_MOVIE_VIEWS, false);
}
_root.NewgroundsAPI_loadMyMovie = function () {
_root.NewgroundsAPI.sendStats(_root.NewgroundsAPI.STAT_NEW_VERSION, true);
};
_root.NewgroundsAPI_loadNewgrounds = function () {
_root.NewgroundsAPI.sendStats(_root.NewgroundsAPI.STAT_NEWGROUNDS, true);
};
_root.NewgroundsAPI_loadMySite = function () {
_root.NewgroundsAPI.sendStats(_root.NewgroundsAPI.STAT_AUTHOR_SITE, true);
};
_root.NewgroundsAPI_loadCustomLink = function (link) {
if (_root.NewgroundsAPI.customStats[link]) {
_root.NewgroundsAPI.sendStats(_root.NewgroundsAPI.customStats[link], true);
} else {
_root.NewgroundsAPI.sendError(("The custom link '" + link) + "' has not beed defined.");
}
};
_root.NewgroundsAPI_logCustomEvent = function (event) {
if (_root.NewgroundsAPI.customStats[event]) {
_root.NewgroundsAPI.sendStats(_root.NewgroundsAPI.customStats[event], false);
} else {
_root.NewgroundsAPI.sendError(("The custom event '" + event) + "' has not beed defined.");
}
};
if (typeof(_root.NewgroundsAPI_onDenyHost) != "function") {
_root.NewgroundsAPI_onDenyHost = function (ad_url) {
_root.NewgroundsAPI.swapDepths(99999);
_root.NewgroundsAPI._visible = true;
_root.NewgroundsAPI.POPUP_ERROR._visible = true;
};
}
if (typeof(_root.NewgroundsAPI_onNewVersionAvailable) != "function") {
_root.NewgroundsAPI_onNewVersionAvailable = function (ad_url) {
_root.NewgroundsAPI.swapDepths(99999);
_root.NewgroundsAPI._visible = true;
_root.NewgroundsAPI.POPUP_VERSION._visible = true;
};
}
stop();