Frame 1
function interfaceReady() {
_root.play();
}
this._lockroot = true;
_root.setMask(_root.gamemask_mc);
stop();
WebsitesFilter.checkWebsite();
var myGameClass = new GameOnAde(GameOnAde.GAME_PUBLIC, this, 700, 530, _root._parent.getGL(), "en", WebsitesFilter.__get__isOnFizzy());
myGameClass.setSecretKey("SzkoMu129y7Nuyd37");
myGameClass.setGameUrl("http://www.gameonade.com/en/game/86/school-uniform");
if ((!WebsitesFilter.fizzy_special) && (!WebsitesFilter.youyouwin_special)) {
if (WebsitesFilter.adsAllowed()) {
var _mochiads_game_id = "696ed6c605a28d10";
mochi.as2.MochiServices.connect(_mochiads_game_id);
mochi.as2.MochiAd.showPreGameAd({id:_mochiads_game_id, res:"700x530", color:15764992, no_bg:true});
mochi.as2.MochiScores.setBoardID("5e6b3a622d71e53d");
} else if (WebsitesFilter.isOn(WebsitesFilter.WEB_MINDJOLT)) {
_root.createEmptyMovieClip("mindjolt_ad_container", 10020);
MindJoltAPI.service.connect("KW2MH2YC27OWLB3E", mindjolt_ad_container, callback);
MindJoltAPI.ad.showPreGameAd({clip:_root});
} else {
play();
}
if (WebsitesFilter.isOn(WebsitesFilter.WEB_KONGREGATE)) {
var kongregate = _global.kongregate;
kongregate.services.connect();
}
if (WebsitesFilter.isOn(WebsitesFilter.WEB_POSZKOLE)) {
System.security.allowDomain("poszkole.pl");
var PoszkoleAPI = _root.createEmptyMovieClip("PoszkoleAPI", 10021);
var PoszkoleAPI_Loader = new MovieClipLoader();
PoszkoleAPI_Loader.loadClip("http://poszkole.pl/poszkoleAPI_AS2.swf", PoszkoleAPI);
var PoszkoleKey = "4fe55edffaa7da415f84f6d0eb9a5b2d";
}
} else if (WebsitesFilter.fizzy_special) {
FizzyAPIas2.initialize(this, this.interfaceReady);
} else if (WebsitesFilter.youyouwin_special) {
trace("YOYOuwin");
FWAd_AS2.showAd({container:this, x:0, y:0, wid:"550", hei:"400", id:"gameonade-snowbattle-1", adType:"loading", onClickCloseBtn:fwAd_onClickCloseBtn});
} else if (WebsitesFilter.newgrounds_special) {
ng_connector._visible = true;
adBoxNG.gotoAndStop("newgrounds");
} else if (WebsitesFilter.cpmstar_special) {
var CPMStarPoolID = 17469;
var CPMStarSubPoolID = 1;
System.security.allowDomain("server.cpmstar.com");
adBoxNG.gotoAndStop("CPMStar");
adBoxNG.adBox.loadMovie((("http://server.cpmstar.com/adviewas2.swf?poolid=" + CPMStarPoolID) + "&subpoolid=") + CPMStarSubPoolID);
}
Frame 2
function moreGames() {
if (WebsitesFilter.youyouwin_special) {
if (WebsitesFilter.isOn(WebsitesFilter.WEB_7K7K)) {
getURL ("http://www.7k7k.com");
}
}
getURL ("http://www.gameonade.com", "_blank");
}
function downloadGame() {
getURL (_root.myGameClass.getGameUrl(), "_blank");
}
function addOtherLogos() {
if (WebsitesFilter.youyouwin_special) {
if (WebsitesFilter.isOn(WebsitesFilter.WEB_7K7K)) {
otherlogos_mc.gotoAndStop("com7k7k");
otherlogos_mc.onRelease = function () {
getURL ("http://www.7k7k.com", "_blank");
};
} else {
otherlogos_mc.gotoAndStop("comyouyouwin");
otherlogos_mc.onRelease = function () {
getURL ("http://www.youyouwin.com", "_blank");
};
}
}
}
function coNaStart() {
clearInterval(moneyInt);
_root.gotoAndPlay("begin");
}
function saveData() {
if (WebsitesFilter.fizzy_special) {
FizzyAPIas2.submitScore(myGameClass.getPointsInfo(), scoreSubmitted);
} else if (WebsitesFilter.isOn(WebsitesFilter.WEB_KONGREGATE)) {
_root.kongregate.stats.submit("HighScore", myGameClass.getPointsInfo());
coNaStart();
} else if (_root.myGameClass.getGameType() == "private") {
_root.myGameClass.savePoints();
} else {
mochi.as2.MochiScores.showLeaderboard({score:myGameClass.getPointsInfo()});
mochi.as2.MochiScores.onClose = function () {
coNaStart();
};
mochi.as2.MochiScores.onError = function () {
coNaStart();
};
}
}
function endGame() {
_root.myGameClass.endGame();
if (WebsitesFilter.isOn(WebsitesFilter.WEB_MINDJOLT)) {
MindJoltAPI.service.submitScore(Math.max(0, _root.myGameClass.getPointsInfo()), null, coNaStart());
_root.has_save = false;
return(true);
}
if (WebsitesFilter.isOn(WebsitesFilter.WEB_POSZKOLE)) {
PoszkoleAPI.submitScore(PoszkoleKey, _root.myGameClass.getPointsInfo());
_root.has_save = false;
return(true);
}
if (WebsitesFilter.isOn(WebsitesFilter.WEB_KONGREGATE)) {
_root.kongregate.stats.submit("HighScore", myGameClass.getPointsInfo());
}
return(false);
}
function scoreSubmitted(success) {
if (success) {
trace("Score submitted");
} else {
trace("Submit error");
}
coNaStart();
}
this._lockroot = true;
var played_first_time = true;
stop();
_root.setMask(gamemask_mc);
if (WebsitesFilter.isOn(WebsitesFilter.WEB_MINDJOLT)) {
myGameClass.startPreloader("gameonade_intro_short");
} else if (WebsitesFilter.youyouwin_special) {
myGameClass.startPreloader("gameonade_intro_short");
} else {
myGameClass.startPreloader("gameonade_intro", false);
}
if (_root.myGameClass.getGameType() == "private") {
myGameClass.startFpsRecording(10000, 10);
}
var has_save = true;
var musicOK = true;
var ksiegarnia_questions = new Array();
ksiegarnia_questions[1] = new Array({q:"How much is it: 2 plus 2?", o1:"5", o2:"4", o3:"8", odp:2}, {q:"What colors you can find on polish flag?", o1:"Red and Grey", o2:"White and Red", o3:"White and Blue", odp:2}, {q:"Which anniversary of American Civil War will be in 2010", o1:"150", o2:"100", o3:"220", odp:1}, {q:"Which group dolphin is belong?", o1:"Mammals", o2:"Fish", o3:"Birds", odp:1}, {q:"Which of these animals do not hibernate in winter?", o1:"Bat", o2:"Pelican", o3:"Bear", odp:2}, {q:"Who was not the president of USA?", o1:"Anthony Hopkins", o2:"Calvin Coolidge", o3:"George Washington", odp:1}, {q:"Which of these animals live the longest?", o1:"Turtles", o2:"Parrots", o3:"Lions", odp:1}, {q:"What is the capital of Poland?", o1:"Gniezno", o2:"Cracow", o3:"Warsaw", odp:3}, {q:"What is the capital of the USA?", o1:"New York", o2:"Chicago", o3:"Washington", odp:3}, {q:"What is the capital of the Czech Republic?", o1:"Prague", o2:"Bratislava", o3:"Budapest", odp:1}, {q:"Which city was the first Polish capital?", o1:"Wroc\u0142aw", o2:"Gniezno", o3:"Cracow", odp:2}, {q:"Which of these fish is the fastest?", o1:"Pike", o2:"Carp", o3:"Swordfish", odp:3}, {q:"Which bone in the human body is the longest?", o1:"Fibula", o2:"Humerus", o3:"Femur", odp:3});
ksiegarnia_questions[2] = new Array({q:"What is NATO?", o1:"The North Atlantic Treaty Organization.", o2:"The same what the European Union is.", o3:"A charity that helps poor countries.", odp:1}, {q:"Which of these animals runs the fastest?", o1:"Horse", o2:"Ostrich", o3:"Cheetah", odp:3}, {q:"What is the capital of Germany?", o1:"Frankfurt", o2:"Berlin", o3:"Munich", odp:2}, {q:"Which of these animals is the smallest?", o1:"Mouse", o2:"Ant-eater", o3:"Humming-bird", odp:3}, {q:"How much is 2 * 2 * 2?", o1:"6", o2:"8", o3:"4", odp:2}, {q:"What is the result of dividing the number 16 for 4?", o1:"4", o2:"6", o3:"3", odp:1}, {q:"How much is 78 subtract 54?", o1:"23", o2:"22", o3:"24", odp:3}, {q:"Who is the creator of Facebook.com?", o1:"Jimmy Wales", o2:"Mark Zuckerberg", o3:"Sergey Brin", odp:2}, {q:"Who is the creator of Amazon.com?", o1:"Jimmy Wales", o2:"Sergey Brin", o3:"Jeff Bezos", odp:3}, {q:"Who is the creator of Yahoo.com?", o1:"Larry Page", o2:"Jerry Yang", o3:"Sergey Brin", odp:2}, {q:"Which of these animals is the biggest?", o1:"Cow", o2:"Elephant", o3:"Horse", odp:2});
ksiegarnia_questions[3] = new Array({q:"How much is 5 * 5 * 5?", o1:"120", o2:"15", o3:"125", odp:3}, {q:"What does UEFA mean?", o1:"Union of European Volleyball Associations", o2:"Union of European Football Associations", o3:"European Union Files Association", odp:2}, {q:"Which of these animals is a parasite?", o1:"Mosquito", o2:"Hare", o3:"Tiger", odp:1}, {q:"What is the European Union?", o1:"Military alliance, which includes all countries within the territory of Europe.", o2:"The political alliance of the richest countries on the territory of Europe.", o3:"Economic - political union dozen European countries.", odp:3}, {q:"Which of the following application is not a web browser?", o1:"Internet Explorer", o2:"Google", o3:"Mozilla Firefox", odp:2}, {q:"What is the square root of 4?", o1:"4", o2:"32", o3:"2", odp:3}, {q:"In which of these countries there is a monarchy?", o1:"Germany", o2:"England", o3:"France", odp:2}, {q:"In which year did World War II begin?", o1:"1935", o2:"1945", o3:"1939", odp:3}, {q:"What is the capital of Canada?", o1:"Ontario", o2:"Ottawa", o3:"Orleans", odp:2}, {q:"Which city is the capital of Russia?", o1:"St. Petersburg", o2:"Berlin", o3:"Moscow", odp:3}, {q:"What is the largest mammal?", o1:"Blue Whale", o2:"African Elephant", o3:"Polar Bear", odp:1}, {q:"Which of these plants is growing the fastest?", o1:"Pine", o2:"Bamboo", o3:"Birch", odp:2}, {q:"Who is the creator of Gameonade.com?", o1:"Larry Page", o2:"Mark Zuckerberg", o3:"Michal Cieslak", odp:3});
ksiegarnia_questions[4] = new Array({q:"What is the first element on the periodic table?", o1:"Helium", o2:"Hydrogen", o3:"Bromine", odp:2}, {q:"What is the square root of 9?", o1:"18", o2:"2", o3:"3", odp:3}, {q:"How much is 10 * 10 * 10 * 10 * 10?", o1:"100 000", o2:"10 000", o3:"1 000 000", odp:1}, {q:"In which year did World War I begin?", o1:"1914", o2:"1910", o3:"1912", odp:1}, {q:"What is Internet?", o1:"Worldwide computer network", o2:"Internal computer network", o3:"Worldwide telephone network", odp:1}, {q:"What is a Capybara?", o1:"Roden", o2:"Invertebrate", o3:"Reptile", odp:1}, {q:"On what continent live platypuses?", o1:"Australia", o2:"Africa", o3:"Europe", odp:1}, {q:"What is the capital of France?", o1:"Paris", o2:"Berlin", o3:"Calais", odp:1}, {q:"What is the capital of Italy?", o1:"Florence", o2:"Venice", o3:"Rome", odp:3}, {q:"Which city is the capital of Hungary?", o1:"Budapest", o2:"Berlin", o3:"Moscow", odp:1}, {q:"Who made the evolution theory?", o1:"Charles Darwin", o2:"Isaac Newton", o3:"Albert Einstein", odp:1}, {q:"How much is 1 / 4 in decimal form?", o1:"0,20", o2:"0,25", o3:"0,50", odp:2}, {q:"Who first circumnavigated the Earth around?", o1:"Gagarin", o2:"Columbus", o3:"Magellan", odp:3});
ksiegarnia_questions[5] = new Array({q:"How to check the age of tree?", o1:"Counting the number of grain.", o2:"Counting the number of leaves or needles.", o3:"After the height of the trunk.", odp:1}, {q:"What does the abbreviation of UFO?", o1:"Unidentified Floating Object", o2:"Earthly Flying Object", o3:"Unidentified Flying Object", odp:3}, {q:"What is the value of PI?", o1:"3.24", o2:"3.15", o3:"3.14", odp:3}, {q:"Who invented the light bulb?", o1:"Nikola Tesla", o2:"Heinrich Hertz", o3:"Thomas Edison", odp:3}, {q:"Who invented the radio?", o1:"Nikola Tesla", o2:"Guglielmo Marconiego", o3:"Alexander Bell", odp:2}, {q:"Who invented the telephone?", o1:"Nikola Tesla", o2:"Alexander Bell", o3:"Heinrich Hertz", odp:2}, {q:"Who invented dynamite?", o1:"Alfred Nobel", o2:"Alexander Bell", o3:"Heinrich Hertz", odp:1}, {q:"Who is the creator of Ebay.com?", o1:"Larry Page", o2:"Mark Zuckerberg", o3:"Pierre Omidyar", odp:2}, {q:"Who is the creator of Google.com?", o1:"Larry Page", o2:"Mark Zuckerberg", o3:"David Filo", odp:1}, {q:"Who is the creator of Google.com?", o1:"Jimmy Wales", o2:"Mark Zuckerberg", o3:"Sergey Brin", odp:3}, {q:"What is the absolute value of -2?", o1:"0", o2:"3", o3:"2", odp:3}, {q:"Who invented the theory of relativity?", o1:"Blaise Pascal", o2:"Isaac Newton", o3:"Albert Einstein", odp:3}, {q:"The first landing on the Moon was in year?", o1:"1966", o2:"1969", o3:"1968", odp:2});
var lang_arr = new Array();
lang_arr.didnt_get_points = "\nYou get half of your points.";
lang_arr.bookstore_waiting_1 = "Respond time: ";
lang_arr.bookstore_waiting_2 = " seconds";
lang_arr.bookstore_time_end = "Your time is over." + lang_arr.didnt_get_points;
lang_arr.bookstore_good_answer = "Good answer";
lang_arr.bookstore_wrong_answer = "Wrong answer";
lang_arr.bookstore_info_wrong_answer = "Unfortunately the last answer was wrong." + lang_arr.didnt_get_points;
lang_arr.musicstore_listen = "Watch and listen!";
lang_arr.musicstore_last_was_wrong = "Unfortunately the last sound was wrong." + lang_arr.didnt_get_points;
lang_arr.musicstore_repeat_melody = "Repeat the melody ...";
lang_arr.pingpong_last_was_wrong = "Unfortunately you didn't bounce the ball enough times." + lang_arr.didnt_get_points;
lang_arr.pingpong_hit_the_ball_1 = "You bounced the ball ";
lang_arr.pingpong_hit_the_ball_2 = " times. Attention: ";
lang_arr.pingpong_start = "Start !!!";
lang_arr.gokarty_wrong = "Unfortunately your opponent was faster." + lang_arr.didnt_get_points;
lang_arr.gokarty_start = "Start !!!";
lang_arr.space_level = "level: ";
lang_arr.space_lives = "lives: ";
lang_arr.space_points = "points: ";
lang_arr.space_bullets_num = "Bullets: ";
lang_arr.space_time_over = "Unfortunately it was your last life." + lang_arr.didnt_get_points;
lang_arr.strz_level_over = "Level is over - you hit them all.";
lang_arr.strz_bullets_over = "You lost - no bullets left.";
lang_arr.strz_bullets_game_over = "Unfortunately there are no more bulltes." + lang_arr.didnt_get_points;
lang_arr.strz_bullets_num = "Bullets: ";
lang_arr.iceshop_wrong_ice = "Wrong scoops of ice cream or wrong order of them." + lang_arr.didnt_get_points;
lang_arr.iceshop_time_over = "There is no more time." + lang_arr.didnt_get_points;
lang_arr.flowers_water_over = "Unfortunately the water is over." + lang_arr.didnt_get_points;
lang_arr.flowers_watered = "Watered flowers ";
lang_arr.pairs_moves_over = "Unfortunately no more moves available." + lang_arr.didnt_get_points;
lang_arr.pairs_moves_left = "Moves left: ";
lang_arr.fruits_to_much_dropped = "Unfortunately you dropped to much fruits." + lang_arr.didnt_get_points;
lang_arr.fruits_dropped_1 = "Dropped fruits: ";
lang_arr.fruits_dropped_2 = " - to take: ";
lang_arr.fruits_basket_broken = "Your basked is destroyed." + lang_arr.didnt_get_points;
lang_arr.all_levels_ok = "Bravo!\nPassed all the levels.\nYour points: ";
lang_arr.all_levels_ok2 = "Bravo!\n Passed all the levels.\nYour points: ";
lang_arr.user_give_up = "You gave up!\n Your points in this level: ";
lang_arr.main_points = "Points: ";
lang_arr.main_throws = "Dice: ";
lang_arr.main_already_played = "You've already played this game!";
lang_arr.main_bravo_1 = "Bravo! You have ";
lang_arr.main_bravo_2 = " points \nplus 200 because you got to the finis line. Sum: ";
lang_arr.main_bravo_3 = ".\nMinus dice number (";
lang_arr.main_bravo_4 = ") it is ";
lang_arr.bonus_ten_points = "Additional 10 points";
lang_arr.bonus_field_forward = "One field forward";
lang_arr.bonus_extra_throw = "Additional dice";
lang_arr.bonus_double_thrown_number = "Double number";
lang_arr.bonus_lost_25_points = "Lost 25 points";
lang_arr.bonus_one_field_back = "One field backward";
lang_arr.bonus_back_on_start = "Back to the start";
Frame 3
function play_the_music(msc) {
stopAllSounds();
if (_root.musicOK) {
msc.start(0, 1);
msc.onSoundComplete = function () {
this.start(0, 1);
};
}
}
function music_check() {
if (musicOK) {
musicOK = false;
ring_mc.gotoAndStop(1);
poczatek_snd.setVolume(0);
} else {
musicOK = true;
ring_mc.gotoAndStop(2);
poczatek_snd.setVolume(50);
play_the_music(poczatek_snd);
}
}
function setPionekType(N) {
pionek_type = N;
_root.play();
}
myGameClass.startGame();
var music1_mc = _root.createEmptyMovieClip("music1_mc", -101);
var kwiatki_snd = new Sound(music1_mc);
kwiatki_snd.attachSound("kwiatkiSnd");
kwiatki_snd.setVolume(30);
var music2_mc = _root.createEmptyMovieClip("music2_mc", -102);
var lody_snd = new Sound(music2_mc);
lody_snd.attachSound("lodySnd");
lody_snd.setVolume(30);
var music3_mc = _root.createEmptyMovieClip("music3_mc", -103);
var obuwie_snd = new Sound(music3_mc);
obuwie_snd.attachSound("obuwieSnd");
obuwie_snd.setVolume(30);
var music4_mc = _root.createEmptyMovieClip("music4_mc", -104);
var pingpong_snd = new Sound(music4_mc);
pingpong_snd.attachSound("pingpongSnd");
pingpong_snd.setVolume(30);
var music5_mc = _root.createEmptyMovieClip("music5_mc", -105);
var quiz_snd = new Sound(music5_mc);
quiz_snd.attachSound("quizSnd");
var music6_mc = _root.createEmptyMovieClip("music6_mc", -106);
var salongier_snd = new Sound(music6_mc);
salongier_snd.attachSound("salongierSnd");
salongier_snd.setVolume(20);
var music7_mc = _root.createEmptyMovieClip("music7_mc", -107);
var strzelnica_snd = new Sound(music7_mc);
strzelnica_snd.attachSound("strzelnicaSnd");
strzelnica_snd.setVolume(25);
var music8_mc = _root.createEmptyMovieClip("music8_mc", -108);
var gokarty_snd = new Sound(music8_mc);
gokarty_snd.attachSound("gokartySnd");
gokarty_snd.setVolume(50);
var music9_mc = _root.createEmptyMovieClip("music9_mc", -109);
var mundurek_snd = new Sound(music9_mc);
mundurek_snd.attachSound("mundurekSnd");
var music10_mc = _root.createEmptyMovieClip("music10_mc", -110);
var plansza_snd = new Sound(music10_mc);
plansza_snd.attachSound("planszaSnd");
plansza_snd.setVolume(50);
var music11_mc = _root.createEmptyMovieClip("music11_mc", -111);
var poczatek_snd = new Sound(music11_mc);
poczatek_snd.attachSound("poczatekSnd");
poczatek_snd.setVolume(50);
var music12_mc = _root.createEmptyMovieClip("music12_mc", -112);
var warzywa_snd = new Sound(music12_mc);
warzywa_snd.attachSound("warzywaSnd");
warzywa_snd.setVolume(30);
var snd1_mc = _root.createEmptyMovieClip("snd1_mc", -201);
var obuwie1_snd = new Sound(snd1_mc);
obuwie1_snd.attachSound("obuwie_dobre");
obuwie1_snd.setVolume(200);
var snd2_mc = _root.createEmptyMovieClip("snd2_mc", -202);
var obuwie2_snd = new Sound(snd2_mc);
obuwie2_snd.attachSound("obuwie_odwrot");
obuwie2_snd.setVolume(150);
var snd3_mc = _root.createEmptyMovieClip("snd3_mc", -203);
var warzywniak1_snd = new Sound(snd3_mc);
warzywniak1_snd.attachSound("warzywniak_cegla");
var snd4_mc = _root.createEmptyMovieClip("snd4_mc", -204);
var warzywniak2_snd = new Sound(snd4_mc);
warzywniak2_snd.attachSound("gocarty_odliczanie");
var snd5_mc = _root.createEmptyMovieClip("snd5_mc", -205);
var warzywniak3_snd = new Sound(snd5_mc);
warzywniak3_snd.attachSound("warzywniak_zaduzo");
var snd6_mc = _root.createEmptyMovieClip("snd6_mc", -206);
var warzywniak4_snd = new Sound(snd6_mc);
warzywniak4_snd.attachSound("warzywniak_zlapal");
var snd7_mc = _root.createEmptyMovieClip("snd7_mc", -207);
var warzywniak5_snd = new Sound(snd7_mc);
warzywniak5_snd.attachSound("warzywniak_upadek");
var snd8_mc = _root.createEmptyMovieClip("snd8_mc", -208);
var kwiatki1_snd = new Sound(snd8_mc);
kwiatki1_snd.attachSound("kwiatki_nalewanie");
var snd9_mc = _root.createEmptyMovieClip("snd9_mc", -209);
var kwiatki2_snd = new Sound(snd9_mc);
kwiatki2_snd.attachSound("kwiatki_napelniony");
var snd10_mc = _root.createEmptyMovieClip("snd10_mc", -210);
var lody1_snd = new Sound(snd10_mc);
lody1_snd.attachSound("lody_nakladanie");
var snd11_mc = _root.createEmptyMovieClip("snd11_mc", -211);
var strzelnica1_snd = new Sound(snd11_mc);
strzelnica1_snd.attachSound("strzelnica_strzal");
strzelnica1_snd.setVolume(30);
var snd12_mc = _root.createEmptyMovieClip("snd12_mc", -212);
var salongier1_snd = new Sound(snd12_mc);
salongier1_snd.attachSound("salon gier_strzal2");
salongier1_snd.setVolume(15);
var snd13_mc = _root.createEmptyMovieClip("snd13_mc", -213);
var salongier2_snd = new Sound(snd13_mc);
salongier2_snd.attachSound("salon gier_boom");
salongier2_snd.setVolume(10);
var snd14_mc = _root.createEmptyMovieClip("snd14_mc", -214);
var gocarty1_snd = new Sound(snd14_mc);
gocarty1_snd.attachSound("gocarty_odliczanie");
gocarty1_snd.setVolume(40);
var snd15_mc = _root.createEmptyMovieClip("snd15_mc", -215);
var hala1_snd = new Sound(snd15_mc);
hala1_snd.attachSound("hala_blokada");
hala1_snd.setVolume(30);
var snd16_mc = _root.createEmptyMovieClip("snd16_mc", -216);
var gocarty2_snd = new Sound(snd16_mc);
gocarty2_snd.attachSound("gocarty_silnik");
var snd17_mc = _root.createEmptyMovieClip("snd17_mc", -217);
var gocarty3_snd = new Sound(snd17_mc);
gocarty3_snd.attachSound("gocarty_silnik");
var snd18_mc = _root.createEmptyMovieClip("snd18_mc", -218);
var hala2_snd = new Sound(snd18_mc);
hala2_snd.attachSound("hala_odbicie");
var snd19_mc = _root.createEmptyMovieClip("snd19_mc", -219);
var yesno_snd = new Sound(snd19_mc);
yesno_snd.attachSound("yes_or_no");
yesno_snd.setVolume(25);
var pionek_type = 1;
var can_choose = true;
play_the_music(poczatek_snd);
if (musicOK) {
ring_mc.gotoAndStop(2);
} else {
ring_mc.gotoAndStop(1);
}
ring_mc.onRelease = music_check;
men_mc.onRelease = function () {
if (can_choose) {
setPionekType(1);
}
};
women_mc.onRelease = function () {
if (can_choose) {
setPionekType(2);
}
};
men_mc.onRollOver = function () {
if (can_choose) {
this.filters = fA;
this.swapDepths(women_mc);
this._xscale = (this._yscale = 120);
}
};
women_mc.onRollOver = function () {
if (can_choose) {
this.filters = fA;
this._xscale = (this._yscale = 120);
}
};
men_mc.onRollOut = function () {
if (can_choose) {
this.filters = nfA;
this.swapDepths(women_mc);
this._xscale = (this._yscale = 116.8);
}
};
women_mc.onRollOut = function () {
if (can_choose) {
this.filters = nfA;
this._xscale = (this._yscale = 116.8);
}
};
men_mc.onReleaseOutside = function () {
if (can_choose) {
this.filters = nfA;
this.swapDepths(women_mc);
this._xscale = (this._yscale = 116.8);
}
};
women_mc.onReleaseOutside = function () {
if (can_choose) {
this.filters = nfA;
this._xscale = (this._yscale = 116.8);
}
};
var gF = (new flash.filters.GlowFilter(0, 30, 15, 15, 1, 1, false, false));
var sF = (new flash.filters.DropShadowFilter(20, 187, 0, 0.9, 5, 5, 0.18, 1));
var fA = new Array(sF, gF);
var nfA = new Array(sF);
men_mc.filters = (women_mc.filters = nfA);
info_mc._visible = false;
rules_btn.onRelease = function () {
info_mc._visible = true;
info_mc.gotoAndStop(1);
can_choose = false;
info_mc.close_btn.onRelease = function () {
this._parent._visible = false;
can_choose = true;
};
};
stop();
_root.setMask(gamemask_mc);
Frame 4
function begin() {
menu_mc._visible = true;
move_to_ex_field = false;
trow_count = true;
start_time = getTimer();
pekaty = new Array();
specialsAlreadyDone = new Array();
trows = 0;
punkty = 0;
pointsSum = 0;
clear_all_glows();
can_play = true;
pionek_mc = _root.attachMovie("pionek", "pionek_mc", 1);
losuj_btn._visible = true;
pionek_moving = false;
last_field = (current_pos = 0);
pionek_mc._x = get_name(current_pos)._x;
pionek_mc._y = get_name(current_pos)._y;
pionek_mc._visible = true;
with (pionek_mc) {
head_mc.gotoAndStop(pionek_type);
body_mc.gotoAndStop(pionek_type);
legs_mc.gotoAndStop(pionek_type);
}
clear_glow(current_pos, true);
_root.all_mc.question_mc._visible = false;
double_trow(false);
info_display();
game_is_end = false;
clearPointTextfields();
}
function info_display() {
trace("INFO DISPLAY");
pointsSum = punkty;
points_txt.text = _root.lang_arr.main_points + pointsSum;
trows_txt.text = _root.lang_arr.main_throws + trows;
}
function check_position(POS, T) {
last_field = POS;
double_trow(false);
if ((field_type[POS] == 1) || (T == 1)) {
add_points(10);
check_if_can_move(5);
question_show(_root.lang_arr.bonus_ten_points);
trace("Dodatkowe punkty");
} else if ((field_type[POS] == 2) || (T == 2)) {
var _local5 = goto_similar(POS);
if (_local5) {
check_if_can_move(5);
} else {
check_if_can_move(28);
}
trace("Przej\u015Bcie na najbli\u017Csze takie samo pole");
} else if ((field_type[POS] == 3) || (T == 3)) {
move_to_exact_field(POS + 1);
check_if_can_move(20);
question_show(_root.lang_arr.bonus_field_forward);
trace("O jeden w prz\u00F3d");
} else if ((field_type[POS] == 4) || (T == 4)) {
check_if_can_move(7);
trow_count = false;
question_show(_root.lang_arr.bonus_extra_throw);
trace("Dodatkowy rzut kostk\u0105");
} else {
if (field_type[POS] == 5) {
check_if_can_move(5);
var _local4 = losuj(9);
if (_local4 == 2) {
_local4 = 1;
} else if (_local4 == 5) {
_local4 = 7;
}
trace("NIESPODZIANKA nr:" + _local4);
bonus_pytajnik(POS, _local4);
return(true);
}
if ((field_type[POS] == 6) || (T == 6)) {
check_if_can_move(5);
double_trow(true);
question_show(_root.lang_arr.bonus_double_thrown_number);
trace("W nast\u0119pnym ruchu mno\u017Comy ilo\u015B\u0107 oczek razy dwa");
} else if ((field_type[POS] == 7) || (T == 7)) {
check_if_can_move(5);
add_points(-25);
question_show(_root.lang_arr.bonus_lost_25_points);
trace("Tracisz punkty");
} else if ((field_type[POS] == 8) || (T == 8)) {
move_to_exact_field(POS - 1);
check_if_can_move(20);
question_show(_root.lang_arr.bonus_one_field_back);
trace("Cofasz si\u0119 o jedno pole");
} else if ((field_type[POS] == 9) || (T == 9)) {
if (POS <= 50) {
check_if_can_move(12);
} else if (POS <= 80) {
check_if_can_move(30);
} else {
check_if_can_move(45);
}
move_to_exact_field(0);
question_show(_root.lang_arr.bonus_back_on_start);
trace("Wracasz na start");
} else if (field_type[POS] == "S") {
show_special(POS);
kostka_stop();
trace("MINI GRA HAHAHA");
} else {
check_if_can_move(5);
}
}
}
function show_special(N) {
current_special_num = N;
current_special_points = 0;
menu_mc._visible = false;
clearInterval(question_interval);
var _local8 = false;
if (!game_is_end) {
}
pionek_mc._visible = false;
var _local3 = _root.attachMovie("ramka", "special_bg_mc", 10);
var _local6 = "s" + N;
var _local9 = "k" + N;
_local3._xscale = (_local3._yscale = 5);
_local3._visible = true;
_local3.symbol_mc.gotoAndStop(_local6);
_local3.napis_mc.gotoAndStop(_local9);
var _local7 = _root.all_mc[_local6 + "_mc"];
_local3._x = _local7._x;
_local3._y = _local7._y;
_local3.points = 0;
_local3.onEnterFrame = function () {
if (this._xscale < 100) {
this._xscale = this._xscale + 5;
this._yscale = this._yscale + 5;
move_it(30, 50, 4, this);
} else {
delete this.onEnterFrame;
}
};
_local3.game_num = N;
_local3.game_level = 1;
make_blur(true, all_mc, 6);
var _local4 = _local3.opis_mc;
_local4._visible = true;
if (!game_is_end) {
if (!_local8) {
_local4.instruction_mc.gotoAndStop("o" + String(N));
_local4.graj_btn.onRelease = function () {
this._parent._parent.begin_game(this._parent._parent.game_num);
this._parent._visible = false;
};
} else {
_local4.gotoAndStop(3);
_local4.result_txt.text = _root.lang_arr.main_already_played;
}
} else {
var _local11 = pointsSum;
add_points(200);
var _local10 = pointsSum;
add_points(-trows);
_local4.gotoAndStop(3);
_local4.result_txt.text = (((((((_root.lang_arr.main_bravo_1 + _local11) + _root.lang_arr.main_bravo_2) + _local10) + _root.lang_arr.main_bravo_3) + trows) + _root.lang_arr.main_bravo_4) + pointsSum) + ".";
}
}
function bonus_pytajnik(CP, LOS) {
check_position(CP, LOS);
}
function double_trow(WH) {
if_double_trow = WH;
_root.all_mc.losuj_btn.double_trow_mc._visible = WH;
}
function goto_similar(F) {
if (move_to_ex_field) {
return(true);
}
if (F == 6) {
move_to_exact_field(25);
} else if (F == 25) {
move_to_exact_field(6);
} else if (F == 33) {
move_to_exact_field(60);
} else if (F == 60) {
move_to_exact_field(33);
} else if (F == 72) {
move_to_exact_field(81);
} else if (F == 81) {
move_to_exact_field(72);
} else if (F == 85) {
move_to_exact_field(104);
} else if (F == 104) {
move_to_exact_field(85);
}
move_to_ex_field = true;
return(false);
}
function move_to_exact_field(F) {
var can_change = false;
_root.onEnterFrame = function () {
if (can_change) {
current_pos = F;
delete this.onEnterFrame;
clear_glow(F, true);
clear_glow(last_field, false);
check_position(current_pos);
} else {
can_change = move_it(get_name(F)._x, get_name(F)._y, 5, pionek_mc);
}
};
}
function add_points(P) {
if ((punkty + P) <= 0) {
punkty = 0;
myGameClass.setPoints(0);
} else {
punkty = punkty + P;
myGameClass.addPoints(P);
}
info_display();
pekaty.push({p:P, pc:punkty, t:trows, tm:current_time()});
}
function current_time() {
return(getTimer() - start_time);
}
function clear_all_glows() {
i = 0;
while (i <= num_of_fields) {
clear_glow(i, false);
i++;
}
all_mc.losuj_btn.glow_mc._visible = false;
}
function clear_glow(NUM, S) {
get_name(NUM).glow_mc._visible = S;
}
function get_name(L) {
var s = (("p" + L) + "_mc");
var m = eval ("_root.all_mc." + s);
return(m);
}
function losuj(NUM) {
var _local1 = Math.ceil(Math.random() * NUM);
return(_local1);
}
function pionek_go(L, ST, DIR) {
var c_pos = current_pos;
var last_c_pos = c_pos;
var can_change = true;
var stoper = ST;
_root.pionek_mc.onEnterFrame = function () {
if (c_pos == (current_pos + (DIR * (L + 1)))) {
current_pos = current_pos + (DIR * L);
if (current_pos < 0) {
current_pos = 0;
}
delete this.onEnterFrame;
check_position(current_pos);
} else if (can_change) {
if (last_c_pos != c_pos) {
last_c_pos = c_pos;
clear_glow(c_pos, true);
clear_glow(c_pos - 1, false);
clear_glow(c_pos + 1, false);
}
if (stoper >= ST) {
c_pos = c_pos + DIR;
can_change = false;
stoper = 0;
if (num_of_fields < c_pos) {
delete this.onEnterFrame;
win_the_game();
}
}
stoper++;
} else if (get_name(c_pos)._x == undefined) {
can_change = false;
c_pos = current_pos + (DIR * (L + 1));
} else {
can_change = move_it(get_name(c_pos)._x, get_name(c_pos)._y, 5, pionek_mc);
}
};
}
function get_dir(MC, MC2, MOUSE) {
var _local7 = MC._x;
var _local6 = MC._y;
var _local5;
var _local4;
if (MOUSE) {
_local5 = MC._parent._xmouse;
_local4 = MC._parent._ymouse;
} else {
_local5 = MC2._x;
_local4 = MC2._y;
}
var _local2 = _local7 - _local5;
var _local1 = _local6 - _local4;
var _local10 = Math.atan2(_local1, _local2);
var _local9 = Math.sqrt((_local2 * _local2) + (_local1 * _local1));
var _local8 = new Object({c:_local10, v:_local9});
return(_local8);
}
function scale_it(n, ob) {
var _local3 = ob._xscale;
_local3 = _local3 + n;
ob._xscale = (ob._yscale = _local3);
if (ob._xscale <= 0) {
end_game(false);
clearInterval(_root["c_int" + ob.c_num]);
}
if (ob._xscale > 100) {
ob._xscale = 100;
ob._yscale = 100;
}
}
function move_it(MX, MY, DELAY, OB) {
var _local3 = OB._x;
var _local2 = OB._y;
var _local5 = _local3 + ((MX - _local3) / DELAY);
var _local4 = _local2 + ((MY - _local2) / DELAY);
OB.polX = _local5;
OB.polY = _local4;
OB._x = _local5;
OB._y = _local4;
if ((Math.abs(OB._x - MX) < 1) && (Math.abs(OB._y - MY) < 1)) {
OB._x = MX;
OB._y = MY;
return(true);
}
if ((MX == undefined) || (MY == undefined)) {
return(true);
}
return(false);
}
function win_the_game() {
trace("Wygra\u0142e\u015B - koniec gry");
game_is_end = true;
can_play = false;
losuj_btn._visible = true;
show_special(107);
}
function make_blur(W, MC, B) {
var _local1 = new Array();
if (W) {
var _local2 = new flash.filters.BlurFilter(B, B, 3);
_local1.push(_local2);
}
MC.filters = _local1;
}
function check_if_can_move(DO) {
var wait = 0;
delete a.onEnterFrame;
var a = _root.createEmptyMovieClip("a_mc", 100);
a.onEnterFrame = function () {
wait++;
if (wait > DO) {
all_mc.losuj_btn.kostka_mc.gotoAndPlay(1);
all_mc.losuj_btn.enabled = true;
all_mc.losuj_btn.glow_mc._visible = false;
pionek_moving = false;
delete this.onEnterFrame;
}
};
trace("WAIT END:" + wait);
}
function kostka_stop() {
all_mc.losuj_btn.enabled = false;
all_mc.losuj_btn.glow_mc._visible = true;
all_mc.losuj_btn.kostka_mc.gotoAndStop(1);
pionek_moving = true;
delete a_mc.onEnterFrame;
removeMovieClip(a_mc);
}
function question_show(W) {
clearInterval(question_interval);
_root.all_mc.question_mc._visible = true;
if (W == "direction") {
_root.all_mc.question_mc.go_mc._visible = true;
_root.all_mc.question_mc.title_txt.text = "";
} else {
_root.all_mc.question_mc.go_mc._visible = false;
_root.all_mc.question_mc.title_txt.text = W;
question_interval = setInterval(hide_question_mc, 1500);
}
}
function hide_question_mc() {
trace("hide_question_mc:" + Math.random());
_root.all_mc.question_mc._visible = false;
_root.all_mc.question_mc.title_txt.text = "";
clearInterval(question_interval);
}
function displayConfirmWindow() {
confirm_window_mc = _root.attachMovie("confirm_window", "confirm_window_mc", 12000);
confirm_window_mc._x = (game_width / 2) - (confirm_window_mc._width / 2);
confirm_window_mc._y = (game_height / 2) - (confirm_window_mc._height / 2);
confirm_window_mc.gotoAndStop("quit_game");
confirm_window_mc.yes_mc.onRelease = function () {
removeMovieClip(pionek_mc);
_root.gotoAndPlay("begin");
_root.hideConfirmWindow();
};
confirm_window_mc.no_mc.onRelease = function () {
_root.hideConfirmWindow();
};
}
function hideConfirmWindow() {
removeMovieClip(_root.confirm_window_mc);
}
function clearPointTextfields() {
var _local3;
var _local2 = 0;
while (_local2 < field_type.length) {
if (field_type[_local2] == "S") {
_local3 = _root.all_mc[("points" + _local2) + "_txt"];
_local3.text = "";
}
_local2++;
}
}
var last_time_ad_displayed = 0;
myGameClass.timerStart();
var confirm_window_mc = new MovieClip();
var game_width = 700;
var game_height = 530;
if (played_first_time) {
tutorial_mc._visible = true;
} else {
tutorial_mc._visible = false;
}
play_the_music(plansza_snd);
var kostka_arr = new Array(1, 2, 3, 4, 5, 6);
var field_type = new Array(0, 0, 1, 0, "S", 0, 2, 3, 0, 0, 0, 4, 0, 5, 0, 6, 0, 0, 0, "S", 0, 7, 8, 0, 0, 2, 0, 0, 0, 3, "S", 0, 3, 2, 0, 0, 0, 6, 0, 0, 8, 0, "S", 0, 4, 0, 5, 0, 1, 0, "S", 0, 0, 3, 7, 0, 9, 0, "S", 0, 2, 0, 0, 0, 6, 8, 0, 7, 0, 0, "S", 0, 2, 0, 0, 9, 0, 1, 0, 0, 3, 2, 0, 5, 0, 2, "S", 0, 1, 0, 0, 4, 8, 0, 0, "S", 0, 9, 0, 6, 0, "S", 0, 0, 2, 7, 8, "END");
var current_pos = 0;
var num_of_fields = 107;
var can_play;
var pionek_moving;
var move_to_ex_field;
var trow_count;
var if_double_trow;
var pionek_mc;
var pekaty;
var trows;
var punkty;
var start_time;
var last_field;
var current_trow;
var pionek_waiting_time = 10;
var specialsAlreadyDone;
var pointsSum;
var game_is_end;
begin();
var nof = 0;
var current_special_num = 0;
var current_special_points = 0;
_root.all_mc.losuj_btn.onRelease = function () {
if (played_first_time) {
played_first_time = false;
_root.tutorial_mc._visible = false;
}
if (can_play && (!pionek_moving)) {
move_to_ex_field = false;
var _local3 = losuj(kostka_arr.length);
if (if_double_trow) {
_local3 = _local3 * 2;
}
trace("wylosowano:" + _local3);
current_trow = _local3;
kostka_stop();
this.kostka_mc.gotoAndPlay("trowit");
if (trow_count) {
trows++;
}
trow_count = true;
trace("TROWS:" + trows);
info_display();
}
if (!can_play) {
begin();
}
};
var question_interval;
menu_mc.onRelease = function () {
displayConfirmWindow();
};
stop();
_root.setMask(gamemask_mc);
Frame 5
function get_points() {
return(pointsSum);
}
function display_player(ES) {
var _local3 = new MovieClip();
var _local4;
var _local2 = 0;
while (_local2 < elements.length) {
_local3 = _root.pionekwindow_mc.man_mc[("" + elements[_local2]) + "_mc"];
_local4 = ES[_local2];
if (_local4 != 0) {
_local3._visible = true;
_local3.gotoAndStop(_local4);
} else {
_local3._visible = false;
}
_local2++;
}
price_mc.price_txt.text = currentCost;
}
function make_clicks() {
var _local3 = new MovieClip();
var _local6 = new MovieClip();
var _local5 = new String();
var _local4 = 0;
while (_local4 < elements.length) {
var _local2 = 1;
while (_local2 <= 3) {
_local5 = (elements[_local4] + String(_local2)) + "_mc";
_local6 = all_mc["p" + _local5];
_local6.price_txt.text = ((_local4 + 1) * 8) * _local2;
_local3 = all_mc[_local5];
_local3.num = _local2;
_local3.typenum = _local4;
_local3.thiscost = Number(_local6.price_txt.text);
_local3.onRelease = function () {
if (temp_elements_selected[this.typenum] == this.num) {
temp_elements_selected[this.typenum] = 0;
currentCost = currentCost - this.thiscost;
} else {
if ((temp_elements_selected[this.typenum] != this.num) && (temp_elements_selected[this.typenum] != 0)) {
var _local3 = temp_elements_selected[this.typenum];
var _local2 = Number(all_mc[(("p" + elements[this.typenum]) + String(_local3)) + "_mc"].price_txt.text);
currentCost = currentCost - _local2;
}
temp_elements_selected[this.typenum] = this.num;
currentCost = currentCost + this.thiscost;
}
display_player(temp_elements_selected);
};
_local2++;
}
_local4++;
}
}
function show_money_less() {
trace("show_money_less:" + Math.random());
komunikat_mc._visible = false;
clearInterval(moneyInt);
}
function show_end_screen() {
trace(("[show_end_screen:" + Math.random()) + "]");
clearInterval(moneyInt);
end_mc._visible = true;
end_mc.start_btn.onRelease = function () {
_root.gotoAndPlay("begin");
};
end_mc.save_btn.onRelease = function () {
_root.saveData();
};
end_mc.points_plansza_txt.text = get_points();
end_mc.points_mundurek_txt.text = get_mundurek_points();
points_all = get_points() + get_mundurek_points();
myGameClass.addPoints(get_mundurek_points());
end_mc.points_all_txt.text = points_all;
_root.endGame();
}
function get_mundurek_points() {
var _local2 = new Array({val:0, it:-1}, {val:0, it:1}, {val:0, it:2}, {val:0, it:3});
var _local3 = 0;
var _local1 = 0;
while (_local1 < elements_selected.length) {
if (elements_selected[_local1] != 0) {
_local3++;
_local2[elements_selected[_local1]].val++;
}
_local1++;
}
_local2.sortOn("val", Array.DESCENDING | Array.NUMERIC);
var _local4 = 10 * ((_local3 * _local2[0].val) * _local2[0].it);
return(_local4);
}
function displaySort(A) {
var _local1 = 0;
while (_local1 < A.length) {
trace((((((("A[" + _local1) + "].it:") + A[_local1].it) + " | A[") + _local1) + "].val:") + A[_local1].val);
_local1++;
}
}
play_the_music(mundurek_snd);
komunikat_mc._visible = false;
end_mc._visible = false;
pionekwindow_mc.gotoAndStop(pionek_type);
all_mc.gotoAndStop(pionek_type);
var elements = new Array("skarpeta", "krawat", "hat", "shoes", "koszula", "spodnie", "plaszcz");
var elements_selected = new Array(0, 0, 0, 0, 0, 0, 0);
var temp_elements_selected = new Array(0, 0, 0, 0, 0, 0, 0);
var currentCost = 0;
var points_mundurek = 0;
var points_all = 0;
display_player(elements_selected);
points_mc.points_txt.text = get_points();
make_clicks();
var moneyInt;
buy_mc.onRelease = function () {
clearInterval(moneyInt);
if (get_points() >= currentCost) {
trace("KUPNO: OK");
elements_selected = temp_elements_selected.slice();
show_end_screen();
} else {
trace("MASZ ZA MA\u0141O PIENI\u0118DZY");
komunikat_mc._visible = true;
moneyInt = setInterval(show_money_less, 1000);
}
};
stop();
_root.setMask(gamemask_mc);
Symbol 9 MovieClip [gameonade_intro_small_short] Frame 58
_root.play();
removeMovieClip(this);
stop();
Symbol 10 MovieClip [gameonade_intro_short] Frame 1
_root.play();
removeMovieClip(this);
stop();
Symbol 10 MovieClip [gameonade_intro_short] Frame 58
_root.play();
removeMovieClip(this);
stop();
Symbol 29 MovieClip Frame 140
_parent.play();
stop();
Symbol 38 MovieClip Frame 26
stop();
Symbol 38 MovieClip Frame 168
stop();
_parent.is_stop = true;
_parent._parent.is_stop = true;
this.onPress = function () {
getURL (_root.myGameClass.getGameUrl(), "_blank");
};
Symbol 44 MovieClip [gameonade_intro] Frame 1
var is_stop = false;
Symbol 44 MovieClip [gameonade_intro] Frame 9
stop();
Symbol 44 MovieClip [gameonade_intro] Frame 30
stop();
play_game_mc.onRelease = function () {
play();
trace("play_game_mc");
};
play_more_mc.onRelease = function () {
getURL (_root.myGameClass.getGameUrl(), "_blank");
};
Symbol 44 MovieClip [gameonade_intro] Frame 52
_root.play();
removeMovieClip(this);
stop();
Symbol 45 MovieClip [gameonade_intro_small] Frame 1
var is_stop = false;
stop();
Symbol 45 MovieClip [gameonade_intro_small] Frame 2
intro_mc.play();
stop();
Symbol 55 MovieClip [gameonade_preloader] Frame 25
var is_stop = true;
stop();
Symbol 55 MovieClip [gameonade_preloader] Frame 103
_root.play();
removeMovieClip(this);
stop();
Symbol 93 MovieClip Frame 1
stop();
Symbol 117 MovieClip [confirm_window] Frame 1
stop();
Symbol 117 MovieClip [confirm_window] Frame 3
function go_back() {
_root.menu_mc._visible = true;
_root.pionek_mc._visible = true;
_root.make_blur(false, _root.all_mc, 6);
_root.check_if_can_move(1);
}
function show_button() {
clearInterval(temp_int);
dalej_btn._visible = true;
}
dalej_btn.onRelease = function () {
if (_root.game_is_end) {
this._parent._visible = false;
removeMovieClip(this._parent._parent);
removeMovieClip(this);
_root.gotoAndPlay("shop");
} else {
_root.special_bg_mc.onEnterFrame = function () {
if (this._xscale > 5) {
this._xscale = this._xscale - 5;
this._yscale = this._yscale - 5;
_root.move_it(0, 0, 8, this);
} else {
delete this.onEnterFrame;
go_back();
removeMovieClip(this);
}
};
}
};
dalej_btn._visible = false;
var temp_int = setInterval(show_button, 5000);
var display_gameonade = false;
if (WebsitesFilter.adsAllowed()) {
ad_mc.gameonade_ad._visible = false;
mochi.as2.MochiAd.showClickAwayAd({clip:ad_mc, id:_root._mochiads_game_id, ad_loaded:function (width, height) {
show_button();
}});
} else {
display_gameonade = true;
}
if (display_gameonade) {
ad_mc.gameonade_ad._visible = true;
ad_mc.gameonade_ad.onRelease = function () {
getURL ("http://www.gameonade.com", "_blank");
};
}
Symbol 117 MovieClip [confirm_window] Frame 4
stop();
Symbol 141 MovieClip Frame 40
stop();
Symbol 148 Button
on (release) {
startMovie();
}
Symbol 149 MovieClip [Preloader Bar (NewgroundsAPI)] Frame 1
#initclip 45
Object.registerClass("Preloader Bar (NewgroundsAPI)", com.newgrounds.components.PreloaderBar);
#endinitclip
Symbol 176 Button
on (release) {
com.newgrounds.API.loadNewgrounds();
}
Symbol 182 MovieClip Frame 1
onEnterFrame = function () {
if (_visible) {
_rotation = (_rotation + 30);
} else {
delete onEnterFrame;
}
};
Symbol 183 MovieClip Frame 11
gotoAndPlay (1);
Symbol 184 MovieClip [Flash Ad (NewgroundsAPI)] Frame 1
#initclip 46
Object.registerClass("Flash Ad (NewgroundsAPI)", com.newgrounds.components.FlashAd);
#endinitclip
Symbol 193 MovieClip Frame 1
this.onRelease = function () {
getURL ("http://www.gameonade.com", "_blank");
};
Symbol 196 MovieClip Frame 1
stop();
Symbol 196 MovieClip Frame 2
stop();
Instance of Symbol 184 MovieClip [Flash Ad (NewgroundsAPI)] in Symbol 196 MovieClip Frame 2
//component parameters
onClipEvent (construct) {
show_background = true;
}
Instance of Symbol 149 MovieClip [Preloader Bar (NewgroundsAPI)] in Symbol 196 MovieClip Frame 2
//component parameters
onClipEvent (construct) {
AUTO_PLAY = false;
}
Symbol 196 MovieClip Frame 3
stop();
Symbol 1187 MovieClip [__Packages.mochi.as2.MochiAd] Frame 0
class mochi.as2.MochiAd
{
function MochiAd () {
}
static function getVersion() {
return(mochi.as2.MochiServices.getVersion());
}
static function showPreGameAd(options) {
var _local27 = {clip:_root, ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:16747008, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}, ad_progress:function (percent) {
}};
options = _parseOptions(options, _local27);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def") {
options.ad_started();
options.ad_finished();
return(undefined);
}
var clip = options.clip;
var _local24 = 11000;
var _local19 = options.ad_timeout;
if (options.skip) {
_local19 = 0;
}
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local15 = _getRes(options);
var _local5 = _local15[0];
var _local14 = _local15[1];
mc._x = _local5 * 0.5;
mc._y = _local14 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk._x = _local5 * -0.5;
chk._y = _local14 * -0.5;
var _local7 = chk.createEmptyMovieClip("_mochiad_bar", 4);
if (options.no_progress_bar) {
_local7._visible = false;
delete options.no_progress_bar;
} else {
_local7._x = 10;
_local7._y = _local14 - 20;
}
var _local23 = options.color;
delete options.color;
var _local21 = options.background;
delete options.background;
var _local25 = options.outline;
delete options.outline;
var _local6 = _local7.createEmptyMovieClip("_outline", 1);
_local6.beginFill(_local21);
_local6.moveTo(0, 0);
_local6.lineTo(_local5 - 20, 0);
_local6.lineTo(_local5 - 20, 10);
_local6.lineTo(0, 10);
_local6.lineTo(0, 0);
_local6.endFill();
var _local4 = _local7.createEmptyMovieClip("_inside", 2);
_local4.beginFill(_local23);
_local4.moveTo(0, 0);
_local4.lineTo(_local5 - 20, 0);
_local4.lineTo(_local5 - 20, 10);
_local4.lineTo(0, 10);
_local4.lineTo(0, 0);
_local4.endFill();
_local4._xscale = 0;
var _local8 = _local7.createEmptyMovieClip("_outline", 3);
_local8.lineStyle(0, _local25, 100);
_local8.moveTo(0, 0);
_local8.lineTo(_local5 - 20, 0);
_local8.lineTo(_local5 - 20, 10);
_local8.lineTo(0, 10);
_local8.lineTo(0, 0);
chk.ad_msec = _local24;
chk.ad_timeout = _local19;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
mochi.as2.MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
var sendHostProgress = false;
mc.lc.sendHostLoadProgress = function (lc_name) {
sendHostProgress = true;
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec;
};
mc.lc.rpc = function (callbackID, arg) {
mochi.as2.MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
chk.onEnterFrame = function () {
var _local10 = this._parent._parent;
var _local3 = _local10;
while ((!_local3.getBytesTotal()) && (_local3)) {
_local3 = _local3._parent;
}
if (!_local3) {
_local3 = _root;
}
var _local13 = this._parent._mochiad_ctr;
var _local7 = getTimer() - this.started;
var _local5 = false;
var _local6 = _local3.getBytesTotal();
var _local9 = _local3.getBytesLoaded();
var _local4 = (100 * _local9) / _local6;
var _local12 = (100 * _local7) / chk.ad_msec;
var _local11 = this._mochiad_bar._inside;
var _local15 = Math.min(100, Math.min(_local4 || 0, _local12));
_local15 = Math.max(this.last_pcnt, _local15);
this.last_pcnt = _local15;
_local11._xscale = _local15;
options.ad_progress(_local15);
if (sendHostProgress) {
mochi.as2.MochiAd.containerNotify(clip, {id:"hostLoadPcnt", pcnt:_local4}, clip._mochiad._containerLCName);
if (_local4 == 100) {
sendHostProgress = false;
}
}
if (!chk.showing) {
var _local8 = _local13.getBytesTotal();
if ((_local8 > 0) || (typeof(_local8) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if ((_local7 > chk.ad_timeout) && (_local4 == 100)) {
options.ad_failed();
_local5 = true;
}
}
if (_local7 > chk.ad_msec) {
_local5 = true;
}
if (((_local6 > 0) && (_local9 >= _local6)) && (_local5)) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
}
}
};
}
static function showClickAwayAd(options) {
var _local10 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function () {
}, ad_finished:function () {
}, ad_loaded:function (width, height) {
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function () {
}};
options = _parseOptions(options, _local10);
var clip = options.clip;
var _local9 = options.ad_timeout;
delete options.ad_timeout;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var _local3 = clip._mochiad;
_local3.onUnload = function () {
options.ad_finished();
};
var _local5 = _getRes(options);
var _local11 = _local5[0];
var _local8 = _local5[1];
_local3._x = _local11 * 0.5;
_local3._y = _local8 * 0.5;
var chk = _local3.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_timeout = _local9;
chk.started = getTimer();
chk.showing = false;
_local3.lc.adLoaded = options.ad_loaded;
_local3.lc.adSkipped = options.ad_skipped;
_local3.lc.rpc = function (callbackID, arg) {
mochi.as2.MochiAd.rpc(clip, callbackID, arg);
};
_local3.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
var _local21 = false;
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
_local2 = true;
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
options.ad_failed();
_local2 = true;
}
}
if (_local2) {
delete this.onEnterFrame;
}
};
}
static function showInterLevelAd(options) {
var _local13 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}};
options = _parseOptions(options, _local13);
var clip = options.clip;
var _local10 = 11000;
var _local12 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local5 = _getRes(options);
var _local14 = _local5[0];
var _local11 = _local5[1];
mc._x = _local14 * 0.5;
mc._y = _local11 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_msec = _local10;
chk.ad_timeout = _local12;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
mochi.as2.MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec - 250;
};
mc.lc.rpc = function (callbackID, arg) {
mochi.as2.MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
options.ad_failed();
_local2 = true;
}
}
if (_local4 > chk.ad_msec) {
_local2 = true;
}
if (_local2) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
}
}
};
}
static function showPreloaderAd(options) {
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
showPreGameAd(options);
}
static function showTimedAd(options) {
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
showInterLevelAd(options);
}
static function _allowDomains(server) {
var _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function load(options) {
var _local12 = {clip:_root, server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = _parseOptions(options, _local12);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = getVersion();
var _local6 = options.clip;
if (!_isNetworkAvailable()) {
return(null);
}
if (_local6._mochiad_loaded) {
return(null);
}
var _local11 = options.depth;
delete options.depth;
var mc = _local6.createEmptyMovieClip("_mochiad", _local11);
var _local10 = _getRes(options);
options.res = (_local10[0] + "x") + _local10[1];
options.server = options.server + options.id;
delete options.id;
_local6._mochiad_loaded = true;
if (_local6._url.indexOf("http") != 0) {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
}
var _local4 = mc.createEmptyMovieClip("_mochiad_ctr", 1);
for (var _local7 in options) {
_local4[_local7] = options[_local7];
}
var _local9 = _local4.server;
delete _local4.server;
var _local13 = _allowDomains(_local9);
mc.onEnterFrame = function () {
if (this._mochiad_ctr._url != this._url) {
this.onEnterFrame = function () {
if (!this._mochiad_ctr) {
delete this.onEnterFrame;
mochi.as2.MochiAd.unload(this._parent);
}
};
}
};
var _local5 = new Object();
var _local8 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local5.mc = mc;
_local5.name = _local8;
_local5.hostname = _local13;
_local5.allowDomain = function (d) {
return(true);
};
_local5.allowInsecureDomain = _local5.allowDomain;
_local5.connect(_local8);
mc.lc = _local5;
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
_local4.lc = _local8;
_local4.st = getTimer();
if (!options.skip) {
_local4.loadMovie(_local9 + ".swf", "POST");
}
return(mc);
}
static function unload(clip) {
if (typeof(clip) == "undefined") {
clip = _root;
}
if (clip.clip && (clip.clip._mochiad)) {
clip = clip.clip;
}
if (!clip._mochiad) {
return(false);
}
containerNotify(clip, {id:"unload"}, clip._mochiad._containerLCName);
clip._mochiad.removeMovieClip();
delete clip._mochiad_loaded;
delete clip._mochiad;
return(true);
}
static function _isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function _getRes(options) {
var _local3 = options.clip.getBounds();
var _local2 = 0;
var _local1 = 0;
if (typeof(options.res) != "undefined") {
var _local4 = options.res.split("x");
_local2 = parseFloat(_local4[0]);
_local1 = parseFloat(_local4[1]);
} else {
_local2 = _local3.xMax - _local3.xMin;
_local1 = _local3.yMax - _local3.yMin;
}
if ((_local2 == 0) || (_local1 == 0)) {
_local2 = Stage.width;
_local1 = Stage.height;
}
return([_local2, _local1]);
}
static function _parseOptions(options, defaults) {
var _local4 = {};
for (var _local8 in defaults) {
_local4[_local8] = defaults[_local8];
}
if (options) {
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
}
if (_root.mochiad_options) {
var _local5 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local5.length) {
var _local3 = _local5[_local2].split("=");
_local4[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
if (_local4.id == "test") {
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
}
return(_local4);
}
static function rpc(clip, callbackID, arg) {
switch (arg.id) {
case "setValue" :
setValue(clip, arg.objectName, arg.value);
break;
case "getValue" :
var _local4 = getValue(clip, arg.objectName);
containerRpcResult(clip, callbackID, _local4, clip._mochiad._containerLCName);
break;
case "runMethod" :
var _local3 = runMethod(clip, arg.method, arg.args);
containerRpcResult(clip, callbackID, _local3, clip._mochiad._containerLCName);
break;
default :
trace("[mochiads rpc] unknown rpc id: " + arg.id);
}
}
static function setValue(base, objectName, value) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
base[_local2[_local1]] = value;
}
static function getValue(base, objectName) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
return(base[_local2[_local1]]);
}
static function runMethod(base, methodName, argsArray) {
var _local2 = methodName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
if (typeof(base[_local2[_local1]]) == "function") {
return(base[_local2[_local1]].apply(base, argsArray));
}
return(undefined);
}
static function containerNotify(clip, args, lcName) {
var _local1 = clip._mochiad._mochiad_ctr.ad.app;
if (_local1.notify) {
_local1.notify(args);
} else {
new LocalConnection().send(lcName, "notify", args);
}
}
static function containerRpcResult(clip, callbackID, val, lcName) {
var _local1 = clip._mochiad._mochiad_ctr.ad.app;
if (_local1.rpcResult) {
_local1.rpcResult(callbackID, val);
} else {
new LocalConnection().send(lcName, "rpcResult", callbackID, val);
}
}
}
Symbol 1188 MovieClip [__Packages.mochi.as2.MochiEventDispatcher] Frame 0
class mochi.as2.MochiEventDispatcher
{
var eventTable;
function MochiEventDispatcher () {
eventTable = {};
}
function buildDelegate(thisObject, thatObject) {
var _local2 = {thisObject:thisObject, thatObject:thatObject};
if (thatObject != undefined) {
var funct = ((typeof(thatObject) == "string") ? (thisObject[thatObject]) : (thatObject));
_local2.delegate = function (args) {
funct.call(thisObject, args);
};
} else {
_local2.delegate = thisObject;
}
return(_local2);
}
function compareDelegate(d_A, d_B) {
if ((d_A.thisObject != d_B.thisObject) || (d_A.thatObject != d_B.thatObject)) {
return(false);
}
return(true);
}
function addEventListener(event, thisObject, thatObject) {
removeEventListener(event, thisObject, thatObject);
eventTable[event].push(buildDelegate(thisObject, thatObject));
}
function removeEventListener(event, thisObject, thatObject) {
var _local3 = buildDelegate(thisObject, thatObject);
if (eventTable[event] == undefined) {
eventTable[event] = [];
return(undefined);
}
for (var _local4 in eventTable[event]) {
if (!compareDelegate(eventTable[event][_local4], _local3)) {
continue;
}
eventTable[event].splice(Number(_local4), 1);
}
}
function triggerEvent(event, args) {
if (eventTable[event] == undefined) {
return(undefined);
}
for (var _local4 in eventTable[event]) {
eventTable[event][_local4].delegate(args);
}
}
}
Symbol 1189 MovieClip [__Packages.mochi.as2.MochiServices] Frame 0
class mochi.as2.MochiServices
{
static var _id, _container, _clip, _sendChannelName, __get__comChannelName, onError, _listenChannel, _sendChannel;
function MochiServices () {
}
static function get id() {
return(_id);
}
static function get clip() {
return(_container);
}
static function get childClip() {
return(_clip);
}
static function getVersion() {
return("3.9.1 as2");
}
static function allowDomains(server) {
var _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function get isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function set comChannelName(val) {
if (val != undefined) {
if (val.length > 3) {
_sendChannelName = val + "_fromgame";
initComChannels();
}
}
//return(__get__comChannelName());
}
static function get connected() {
return(_connected);
}
static function connect(id, clip, onError) {
warnID(id, false);
if ((!_connected) && (_clip == undefined)) {
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
}
if (onError != undefined) {
mochi.as2.MochiServices.onError = onError;
} else if (mochi.as2.MochiServices.onError == undefined) {
mochi.as2.MochiServices.onError = function (errorCode) {
trace(errorCode);
};
}
}
static function disconnect() {
if (_connected || (_connecting)) {
_connecting = (_connected = false);
flush(true);
if (_clip != undefined) {
_clip.removeMovieClip();
delete _clip;
}
_listenChannel.close();
}
}
static function init(id, clip) {
_id = id;
if (clip != undefined) {
_container = clip;
} else {
_container = _root;
}
loadCommunicator(id, _container);
}
static function loadCommunicator(id, clip) {
var _local6 = "_mochiservices_com_" + id;
var _local5 = new MovieClipLoader();
var _local3 = {};
if (_clip != null) {
return(_clip);
}
if (!isNetworkAvailable) {
return(null);
}
if (urlOptions().servURL) {
_servURL = urlOptions().servURL;
}
var _local4 = _servURL + _services;
if (urlOptions().servicesURL) {
_local4 = urlOptions().servicesURL;
}
allowDomains(_local4);
_clip = clip.createEmptyMovieClip(_local6, 10336, false);
_listenChannelName = _listenChannelName + ((Math.floor(new Date().getTime()) + "_") + Math.floor(Math.random() * 99999));
listen();
if (_local3.waitInterval != null) {
clearInterval(_local3.waitInterval);
}
_local3.onLoadError = loadError;
_local3.onLoadStart = function (target_mc) {
this.isLoading = true;
};
_local3.onLoadComplete = function (target_mc) {
target_mc.MochiServices = mochi.as2.MochiServices;
};
_local3.startTime = getTimer();
_local3.wait = function () {
if ((getTimer() - this.startTime) > 10000) {
if (!this.isLoading) {
mochi.as2.MochiServices.disconnect();
mochi.as2.MochiServices.onError.apply(null, ["IOError"]);
}
clearInterval(this.waitInterval);
}
};
_local3.waitInterval = setInterval(_local3, "wait", 1000);
_local5.addListener(_local3);
_local5.loadClip((((((_local4 + "?listenLC=") + _listenChannelName) + "&mochiad_options=") + escape(_root.mochiad_options)) + "&api_version=") + getVersion(), _clip);
_sendChannel = new LocalConnection();
_sendChannel._queue = [];
return(_clip);
}
static function loadError(target_mc, errorCode, httpStatus) {
trace("MochiServices could not load.");
disconnect();
onError.apply(null, [errorCode]);
}
static function onStatus(infoObject) {
if (!(infoObject.level === "error")) {
} else {
_connected = false;
_listenChannel.connect(_listenChannelName);
}
}
static function listen() {
_listenChannel = new LocalConnection();
_listenChannel.handshake = function (args) {
mochi.as2.MochiServices.__set__comChannelName(args.newChannel);
};
_listenChannel.allowDomain = function (d) {
return(true);
};
_listenChannel.allowInsecureDomain = _listenChannel.allowDomain;
_listenChannel._nextcallbackID = 0;
_listenChannel._callbacks = {};
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
static function initComChannels() {
if (!_connected) {
_sendChannel.onStatus = function (infoObject) {
mochi.as2.MochiServices.onStatus(infoObject);
};
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, version:getVersion()});
_listenChannel.onStatus = function (infoObject) {
mochi.as2.MochiServices.onStatus(infoObject);
};
_listenChannel.onReceive = function (pkg) {
var _local5 = pkg.callbackID;
var _local4 = this._callbacks[_local5];
if (!_local4) {
return(undefined);
}
var _local2 = _local4.callbackMethod;
var _local3 = _local4.callbackObject;
if (_local3 && (typeof(_local2) == "string")) {
_local2 = _local3[_local2];
}
if (_local2 != undefined) {
_local2.apply(_local3, pkg.args);
}
delete this._callbacks[_local5];
};
_listenChannel.onEvent = function (pkg) {
switch (pkg.target) {
case "services" :
mochi.as2.MochiServices.triggerEvent(pkg.event, pkg.args);
break;
case "events" :
mochi.as2.MochiEvents.triggerEvent(pkg.event, pkg.args);
break;
case "coins" :
mochi.as2.MochiCoins.triggerEvent(pkg.event, pkg.args);
break;
case "social" :
mochi.as2.MochiSocial.triggerEvent(pkg.event, pkg.args);
}
};
_listenChannel.onError = function () {
mochi.as2.MochiServices.onError.apply(null, ["IOError"]);
};
trace("[SERVICES_API] connected!");
_connecting = false;
_connected = true;
while (_sendChannel._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _sendChannel._queue.shift());
}
}
}
static function flush(error) {
var _local1;
var _local2;
while (_sendChannel._queue.length > 0) {
_local1 = _sendChannel._queue.shift();
if (_local1.callbackID != null) {
_local2 = _listenChannel._callbacks[_local1.callbackID];
}
delete _listenChannel._callbacks[_local1.callbackID];
if (error) {
handleError(_local1.args, _local2.callbackObject, _local2.callbackMethod);
}
}
}
static function handleError(args, callbackObject, callbackMethod) {
if (args != null) {
if (args.onError != null) {
args.onError.apply(null, ["NotConnected"]);
}
if ((args.options != null) && (args.options.onError != null)) {
args.options.onError.apply(null, ["NotConnected"]);
}
}
if (callbackMethod != null) {
args = {};
args.error = true;
args.errorCode = "NotConnected";
if ((callbackObject != null) && (typeof(callbackMethod) == "string")) {
callbackObject[callbackMethod](args);
} else if (callbackMethod != null) {
callbackMethod.apply(args);
}
}
}
static function send(methodName, args, callbackObject, callbackMethod) {
if (_connected) {
_sendChannel.send(_sendChannelName, "onReceive", {methodName:methodName, args:args, callbackID:_listenChannel._nextcallbackID});
} else {
if ((_clip == undefined) || (!_connecting)) {
trace("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + methodName);
handleError(args, callbackObject, callbackMethod);
flush(true);
return(undefined);
}
_sendChannel._queue.push({methodName:methodName, args:args, callbackID:_listenChannel._nextcallbackID});
}
_listenChannel._callbacks[_listenChannel._nextcallbackID] = {callbackObject:callbackObject, callbackMethod:callbackMethod};
_listenChannel._nextcallbackID++;
}
static function urlOptions() {
var _local5 = {};
var _local6;
if (_root._url.indexOf("mochiad_options") != -1) {
var _local2 = (_root._url.indexOf("mochiad_options") + "mochiad_options".length) + 1;
_local6 = _root._url.substr(_local2, _root._url.length);
} else if (_root.mochiad_options) {
_local6 = _root.mochiad_options;
}
if (_local6) {
var _local4 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2].split("=");
_local5[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
return(_local5);
}
static function warnID(bid, leaderboard) {
bid = bid.toLowerCase();
if (bid.length != 16) {
trace(("WARNING: " + (leaderboard ? "board" : "game")) + " ID is not the appropriate length");
return(undefined);
}
if (bid == "1e113c7239048b3f") {
if (leaderboard) {
trace("WARNING: Using testing board ID");
} else {
trace("WARNING: Using testing board ID as game ID");
}
return(undefined);
}
if (bid == "84993a1de4031cd8") {
if (leaderboard) {
trace("WARNING: Using testing game ID as board ID");
} else {
trace("WARNING: Using testing game ID");
}
return(undefined);
}
var _local1 = 0;
while (_local1 < bid.length) {
switch (bid.charAt(_local1)) {
case "0" :
case "1" :
case "2" :
case "3" :
case "4" :
case "5" :
case "6" :
case "7" :
case "8" :
case "9" :
case "a" :
case "b" :
case "c" :
case "d" :
case "e" :
case "f" :
break;
default :
trace("WARNING: Board ID contains illegal characters: " + bid);
return(undefined);
}
_local1++;
}
}
static function addLinkEvent(url, burl, btn, onClick) {
var timeout = 1500;
var t0 = getTimer();
var _local2 = new Object();
_local2.mav = getVersion();
_local2.swfv = btn.getSWFVersion() || 6;
_local2.swfurl = btn._url;
_local2.fv = System.capabilities.version;
_local2.os = System.capabilities.os;
_local2.lang = System.capabilities.language;
_local2.scres = (System.capabilities.screenResolutionX + "x") + System.capabilities.screenResolutionY;
var s = "?";
var _local3 = 0;
for (var _local6 in _local2) {
if (_local3 != 0) {
s = s + "&";
}
_local3++;
s = ((s + _local6) + "=") + escape(_local2[_local6]);
}
if (!(netupAttempted || (_connected))) {
var ping = btn.createEmptyMovieClip("ping", 777);
var _local7 = btn.createEmptyMovieClip("nettest", 778);
netupAttempted = true;
ping.loadMovie("http://link.mochiads.com/linkping.swf?t=" + getTimer());
_local7.onEnterFrame = function () {
if ((ping._totalframes > 0) && (ping._totalframes == ping._framesloaded)) {
delete this.onEnterFrame;
} else if ((getTimer() - t0) > timeout) {
delete this.onEnterFrame;
mochi.as2.MochiServices.netup = false;
}
};
}
var _local4 = btn.createEmptyMovieClip("clk", 1001);
_local4._alpha = 0;
_local4.beginFill(1044735);
_local4.moveTo(0, 0);
_local4.lineTo(0, btn._height);
_local4.lineTo(btn._width, btn._height);
_local4.lineTo(btn._width, 0);
_local4.lineTo(0, 0);
_local4.endFill();
_local4.onRelease = function () {
if (mochi.as2.MochiServices.netup) {
getURL (url + s, "_blank");
} else {
getURL (burl, "_blank");
}
if (onClick != undefined) {
onClick();
}
};
}
static function setContainer(clip) {
}
static function stayOnTop(clip) {
}
static function addEventListener(eventType, thisObject, thatObject) {
_dispatcher.addEventListener(eventType, thisObject, thatObject);
}
static function triggerEvent(eventType, args) {
_dispatcher.triggerEvent(eventType, args);
}
static function removeEventListener(eventType, thisObject, thatObject) {
_dispatcher.removeEventListener(eventType, thisObject, thatObject);
}
static var CONNECTED = "onConnected";
static var _servURL = "http://www.mochiads.com/static/lib/services/";
static var _services = "services.swf";
static var _mochiLC = "MochiLC.swf";
static var _listenChannelName = "__ms_";
static var _connecting = false;
static var _connected = false;
static var netup = true;
static var netupAttempted = false;
static var _dispatcher = new mochi.as2.MochiEventDispatcher();
}
Symbol 1190 MovieClip [__Packages.mochi.as2.MochiEvents] Frame 0
class mochi.as2.MochiEvents
{
function MochiEvents () {
}
static function getVersion() {
return(mochi.as2.MochiServices.getVersion());
}
static function startSession(achievementID) {
mochi.as2.MochiServices.send("events_beginSession", {achievementID:achievementID}, null, null);
}
static function setNotifications(clip, style) {
var _local2 = {};
for (var _local3 in style) {
_local2[_local3] = style[_local3];
}
_local2.clip = clip;
mochi.as2.MochiServices.send("events_setNotifications", _local2, null, null);
}
static function addEventListener(eventType, thisObject, thatObject) {
_dispatcher.addEventListener(eventType, thisObject, thatObject);
}
static function triggerEvent(eventType, args) {
_dispatcher.triggerEvent(eventType, args);
}
static function removeEventListener(eventType, thisObject, thatObject) {
_dispatcher.removeEventListener(eventType, thisObject, thatObject);
}
static function startPlay(tag) {
if (tag == undefined) {
tag = "gameplay";
}
mochi.as2.MochiServices.send("events_setRoundID", {tag:String(tag)}, null, null);
}
static function endPlay() {
mochi.as2.MochiServices.send("events_clearRoundID", null, null, null);
}
static function trackEvent(tag, value) {
mochi.as2.MochiServices.send("events_trackEvent", {tag:tag, value:value}, null, null);
}
static var ACHIEVEMENT_RECEIVED = "AchievementReceived";
static var ALIGN_TOP_LEFT = "ALIGN_TL";
static var ALIGN_TOP = "ALIGN_T";
static var ALIGN_TOP_RIGHT = "ALIGN_TR";
static var ALIGN_LEFT = "ALIGN_L";
static var ALIGN_CENTER = "ALIGN_C";
static var ALIGN_RIGHT = "ALIGN_R";
static var ALIGN_BOTTOM_LEFT = "ALIGN_BL";
static var ALIGN_BOTTOM = "ALIGN_B";
static var ALIGN_BOTTOM_RIGHT = "ALIGN_BR";
static var FORMAT_SHORT = "ShortForm";
static var FORMAT_LONG = "LongForm";
static var _dispatcher = new mochi.as2.MochiEventDispatcher();
}
Symbol 1191 MovieClip [__Packages.mochi.as2.MochiCoins] Frame 0
class mochi.as2.MochiCoins
{
function MochiCoins () {
}
static function getVersion() {
return(mochi.as2.MochiServices.getVersion());
}
static function showStore(options) {
mochi.as2.MochiServices.send("coins_showStore", {options:options}, null, null);
}
static function showItem(options) {
if ((options == undefined) || (typeof(options.item) != "string")) {
trace("ERROR: showItem call must pass an Object with an item key");
return(undefined);
}
mochi.as2.MochiServices.send("coins_showItem", {options:options}, null, null);
}
static function showVideo(options) {
if ((options == undefined) || (typeof(options.item) != "string")) {
trace("ERROR: showVideo call must pass an Object with an item key");
return(undefined);
}
mochi.as2.MochiServices.send("coins_showVideo", {options:options}, null, null);
}
static function getStoreItems() {
mochi.as2.MochiServices.send("coins_getStoreItems");
}
static function requestFunding(properties) {
mochi.as2.MochiServices.send("social_requestFunding", properties);
}
static function addEventListener(eventType, delegate) {
_dispatcher.addEventListener(eventType, delegate);
}
static function triggerEvent(eventType, args) {
_dispatcher.triggerEvent(eventType, args);
}
static function removeEventListener(eventType, delegate) {
_dispatcher.removeEventListener(eventType, delegate);
}
static var STORE_SHOW = "StoreShow";
static var STORE_HIDE = "StoreHide";
static var ITEM_OWNED = "ItemOwned";
static var ITEM_NEW = "ItemNew";
static var STORE_ITEMS = "StoreItems";
static var ERROR = "Error";
static var IO_ERROR = "IOError";
static var NO_USER = "NoUser";
static var _dispatcher = new mochi.as2.MochiEventDispatcher();
}
Symbol 1192 MovieClip [__Packages.mochi.as2.MochiSocial] Frame 0
class mochi.as2.MochiSocial
{
function MochiSocial () {
}
static function getVersion() {
return(mochi.as2.MochiServices.getVersion());
}
static function showLoginWidget(options) {
mochi.as2.MochiServices.setContainer();
mochi.as2.MochiServices.stayOnTop();
mochi.as2.MochiServices.send("social_showLoginWidget", {options:options});
}
static function hideLoginWidget() {
mochi.as2.MochiServices.send("social_hideLoginWidget");
}
static function requestLogin(properties) {
mochi.as2.MochiServices.send("social_requestLogin", properties);
}
static function getFriendsList(properties) {
mochi.as2.MochiServices.send("social_getFriendsList", properties);
}
static function postToStream(properties) {
mochi.as2.MochiServices.send("social_postToStream", properties);
}
static function inviteFriends(properties) {
mochi.as2.MochiServices.send("social_inviteFriends", properties);
}
static function requestFan(properties) {
mochi.as2.MochiServices.send("social_requestFan", properties);
}
static function saveUserProperties(properties) {
mochi.as2.MochiServices.send("social_saveUserProperties", properties);
}
static function addEventListener(eventType, delegate) {
_dispatcher.addEventListener(eventType, delegate);
}
static function triggerEvent(eventType, args) {
_dispatcher.triggerEvent(eventType, args);
}
static function removeEventListener(eventType, delegate) {
_dispatcher.removeEventListener(eventType, delegate);
}
static var LOGGED_IN = "LoggedIn";
static var LOGGED_OUT = "LoggedOut";
static var LOGIN_SHOW = "LoginShow";
static var LOGIN_HIDE = "LoginHide";
static var LOGIN_SHOWN = "LoginShown";
static var PROFILE_SHOW = "ProfileShow";
static var PROFILE_HIDE = "ProfileHide";
static var PROPERTIES_SAVED = "PropertySaved";
static var WIDGET_LOADED = "WidgetLoaded";
static var FRIEND_LIST = "FriendsList";
static var PROFILE_DATA = "ProfileData";
static var GAMEPLAY_DATA = "GameplayData";
static var ACTION_CANCELED = "onCancel";
static var ACTION_COMPLETE = "onComplete";
static var USER_INFO = "UserInfo";
static var ERROR = "Error";
static var IO_ERROR = "IOError";
static var NO_USER = "NoUser";
static var PROPERTIES_SIZE = "PropertiesSize";
static var _dispatcher = new mochi.as2.MochiEventDispatcher();
}
Symbol 1193 MovieClip [__Packages.WebsitesFilter] Frame 0
class WebsitesFilter
{
function WebsitesFilter () {
}
static function checkWebsite() {
currUrl = _url.toLowerCase();
trace("CHECK WEBSITES:" + currUrl);
websites_ads_allowed[-1] = 1;
var _local1 = 0;
while (_local1 < websites_arr.length) {
if (currUrl.indexOf(websites_arr[_local1]) > 0) {
current_website = _local1;
}
_local1++;
}
}
static function setWebsite(_website) {
current_website = _website;
}
static function adsAllowed() {
return(((websites_ads_allowed[current_website] != undefined) ? (websites_ads_allowed[current_website]) : true));
}
static function isOn(_n) {
trace((("CURRENT WEBSITE:" + current_website) + " RED:") + WEB_REDEFINE);
return((((_n == current_website) || ((_n == WEB_POSZKOLE) && (current_website == WEB_REDEFINE))) ? true : false));
}
static function get isOnFizzy() {
if (fizzy_special) {
return("fizzy");
}
return("");
}
static function get isOnYouyouwin() {
if (youyouwin_special) {
return("youyouwin");
}
return("");
}
static function get isOnNewgrounds() {
if (newgrounds_special) {
return("newgrounds");
}
return("");
}
static var WEB_SPIELAFFE = 0;
static var WEB_ARMORGAMES = 1;
static var WEB_DAILYGAMES = 2;
static var WEB_FREEONLINEGAMES = 3;
static var WEB_KONGREGATE = 4;
static var WEB_NEWGROUNDS = 5;
static var WEB_MINDJOLT = 6;
static var WEB_POSZKOLE = 7;
static var WEB_JUEGOSDIAROS = 8;
static var WEB_FREEADDICTINGGAMES = 9;
static var WEB_FLASHGAMES247 = 10;
static var WEB_NEODELIGHT = 11;
static var WEB_GAMESQUAT = 12;
static var WEB_ONLINEFLASHGAMESORG = 13;
static var WEB_REDEFINE = 14;
static var WEB_7K7K = 15;
static var WEB_Y8 = 16;
static var WEB_4399 = 17;
static var WEB_ADDICTINGGAMES = 18;
static var currUrl = "";
static var current_website = -1;
static var websites_arr = new Array("spielaffe.de", "armorgames.com", "dailygames.com", "freeonlinegames.com", "kongregate.com", "newgrounds.com", "mindjolt.com", "poszkole", "juegosdiarios.com", "freeaddictinggames.com", "flashgames247.com", "neodelight.com", "gamesquat.com", "onlineflashgames.org", "redefine.pl", "7k7k.com", "y8.com", "4399.com", "addictinggames.com");
static var websites_ads_allowed = new Array(0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0);
static var fizzy_special = false;
static var youyouwin_special = false;
static var newgrounds_special = false;
static var cpmstar_special = false;
}
Symbol 1194 MovieClip [__Packages.MindJoltAPI] Frame 0
class MindJoltAPI
{
static var clip, options, gameKey, callback;
function MindJoltAPI () {
}
static function showPreGameAd(options) {
if (clip.mindjolt_api_service == undefined) {
trace("[MindJoltAPI] You must call MindJoltAPI.service.connect before MindJoltAPI.ad.showPreGameAd.");
}
if (options == null) {
options = {};
}
if (service.showPreGameAd != undefined) {
service.showPreGameAd(options);
} else {
MindJoltAPI.options = options;
if (options.ad_started == null) {
((options.clip != null) ? (options.clip) : _root).stop();
}
}
}
static function load_service_complete() {
if (clip.mindjolt_api_service.service != null) {
service = clip.mindjolt_api_service.service;
trace("[MindJoltAPI] service successfully loaded");
service.connect(gameKey, clip, callback);
if (options != null) {
service.recordAction(("showPreGameAd(" + options) + ");");
service.showPreGameAd(options);
}
service.getLogger().info(("MindJoltAPI loader version [" + version) + "]");
} else {
trace("[MindJoltAPI] failed to load.");
}
}
static function connect(gameKey, clip, callback) {
MindJoltAPI.gameKey = gameKey;
MindJoltAPI.clip = ((clip != null) ? (clip) : _root);
MindJoltAPI.callback = callback;
if (service.submitScore == undefined) {
System.security.allowDomain("static.mindjolt.com");
var _local3 = MindJoltAPI.clip.createEmptyMovieClip("mindjolt_api_service", 10000);
var _local4 = ((_level0.mjPath != undefined) ? (_level0.mjPath) : "http://static.mindjolt.com/api/as2/api_local_as2.swf");
var _local2 = new MovieClipLoader();
_local2.addListener({onLoadInit:load_service_complete, onLoadError:load_service_complete});
_local2.loadClip(_local4, _local3);
}
}
static var service = {connect:connect};
static var ad = {showPreGameAd:showPreGameAd};
static var version = "1.0.3";
}
Symbol 1195 MovieClip [__Packages.mochi.as2.MochiScores] Frame 0
class mochi.as2.MochiScores
{
static var boardID, onClose, onError;
function MochiScores () {
}
static function setBoardID(boardID) {
mochi.as2.MochiServices.warnID(boardID, true);
mochi.as2.MochiScores.boardID = boardID;
mochi.as2.MochiServices.send("scores_setBoardID", {boardID:boardID});
}
static function showLeaderboard(options) {
options.clip = mochi.as2.MochiServices.clip;
if ((options.clip != mochi.as2.MochiServices.__get__clip()) || (mochi.as2.MochiServices.__get__childClip()._target == undefined)) {
mochi.as2.MochiServices.disconnect();
trace("WARNING! This application is attempting to connect to MochiServices inside a showLeaderboard call!");
trace("make sure MochiServices.connect is called as early in the application runtime as possible.");
mochi.as2.MochiServices.connect(mochi.as2.MochiServices.__get__id(), options.clip);
}
delete options.clip;
if (options.name != null) {
if (typeof(options.name) == "object") {
if (options.name.text != undefined) {
options.name = options.name.text;
}
}
}
if (options.score != null) {
if (options.score instanceof TextField) {
if (options.score.text != undefined) {
options.score = options.score.text;
}
} else if (options.score instanceof mochi.as2.MochiDigits) {
options.score = options.score.value;
}
var _local1 = Number(options.score);
if (isNaN(_local1)) {
trace(("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'");
} else if ((_local1 == Number.NEGATIVE_INFINITY) || (_local1 == Number.POSITIVE_INFINITY)) {
trace(("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite");
} else {
if (Math.floor(_local1) != _local1) {
trace(("WARNING: Submitted score '" + options.score) + "' will be truncated");
}
options.score = _local1;
}
}
if (options.onDisplay != null) {
options.onDisplay();
} else {
mochi.as2.MochiServices.__get__clip().stop();
}
if (options.onClose != null) {
onClose = options.onClose;
} else {
onClose = function () {
mochi.as2.MochiServices.__get__clip().play();
};
}
if (options.onError != null) {
onError = options.onError;
} else {
onError = onClose;
}
if (options.boardID == null) {
if (boardID != null) {
options.boardID = boardID;
}
}
mochi.as2.MochiServices.warnID(options.boardID, true);
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
mochi.as2.MochiServices.send("scores_showLeaderboard", {options:options}, null, doClose);
}
static function closeLeaderboard() {
mochi.as2.MochiServices.send("scores_closeLeaderboard");
}
static function getPlayerInfo(callbackObj, callbackMethod) {
mochi.as2.MochiServices.send("scores_getPlayerInfo", null, callbackObj, callbackMethod);
}
static function submit(score, name, callbackObj, callbackMethod) {
score = Number(score);
if (isNaN(score)) {
trace(("ERROR: Submitted score '" + String(score)) + "' will be rejected, score is 'Not a Number'");
} else if ((score == Number.NEGATIVE_INFINITY) || (score == Number.POSITIVE_INFINITY)) {
trace(("ERROR: Submitted score '" + String(score)) + "' will be rejected, score is an infinite");
} else {
if (Math.floor(score) != score) {
trace(("WARNING: Submitted score '" + String(score)) + "' will be truncated");
}
score = Number(score);
}
mochi.as2.MochiServices.send("scores_submit", {score:score, name:name}, callbackObj, callbackMethod);
}
static function requestList(callbackObj, callbackMethod) {
mochi.as2.MochiServices.send("scores_requestList", null, callbackObj, callbackMethod);
}
static function scoresArrayToObjects(scores) {
var _local5 = {};
var _local1;
var _local4;
var _local2;
var _local6;
for (var _local8 in scores) {
if (typeof(scores[_local8]) == "object") {
if ((scores[_local8].cols != null) && (scores[_local8].rows != null)) {
_local5[_local8] = [];
_local2 = scores[_local8];
_local4 = 0;
while (_local4 < _local2.rows.length) {
_local6 = {};
_local1 = 0;
while (_local1 < _local2.cols.length) {
_local6[_local2.cols[_local1]] = _local2.rows[_local4][_local1];
_local1++;
}
_local5[_local8].push(_local6);
_local4++;
}
} else {
_local5[_local8] = {};
for (var _local7 in scores[_local8]) {
_local5[_local8][_local7] = scores[_local8][_local7];
}
}
} else {
_local5[_local8] = scores[_local8];
}
}
return(_local5);
}
static function doClose(args) {
if (args.error == true) {
if (args.errorCode == undefined) {
args.errorCode = "IOError";
}
onError.apply(null, [args.errorCode]);
} else {
onClose.apply();
}
}
}
Symbol 1196 MovieClip [__Packages.mochi.as2.MochiDigits] Frame 0
class mochi.as2.MochiDigits
{
var Encoder, Fragment, Sibling;
function MochiDigits (digit, index) {
Encoder = 0;
setValue(digit, index);
}
function get value() {
return(Number(toString()));
}
function set value(v) {
setValue(v);
//return(value);
}
function addValue(v) {
value = value + v;
}
function setValue(digit, index) {
var _local3 = digit.toString();
if ((index == undefined) || (isNaN(index))) {
index = 0;
}
Fragment = _local3.charCodeAt(index++) ^ Encoder;
if (index < _local3.length) {
Sibling = new mochi.as2.MochiDigits(digit, index);
} else {
Sibling = null;
}
reencode();
}
function reencode() {
var _local2 = int(2147483647 * Math.random());
Fragment = Fragment ^ (_local2 ^ Encoder);
Encoder = _local2;
}
function toString() {
var _local2 = String.fromCharCode(Fragment ^ Encoder);
return(((Sibling != null) ? (_local2.concat(Sibling.toString())) : (_local2)));
}
}
Symbol 1197 MovieClip [__Packages.GameOnAde] Frame 0
class GameOnAde
{
var website, game_type, game_mc, game_loader, game_random_key, game_random_key_other, game_loaded, game_width, game_height, game_language, game_played_num, game_highest_score, bt, bl, game_url, game_main_container, secret_key, game_time, fps_average, fps_interval_freq, fps_recorder_length, fps_last_row_num, fps_recorder, fps_interval, game_points, game_points_info, score_saved, preloader_mc;
function GameOnAde (_game_type, _game_mc, _gw, _gh, _GL, _game_lang, _website) {
if (_website != undefined) {
website = _website;
} else {
website = "gameonade";
}
fscommand ("showmenu", false);
Stage.showMenu = false;
if (website == "gameonade") {
Stage.scaleMode = "noScale";
Stage.align = "TL";
fscommand ("allowscale", true);
}
GameLoader.display_info("[Game] - constructor");
game_type = _game_type;
game_mc = _game_mc;
if (game_type == GAME_PRIVATE) {
game_loader = _GL;
game_random_key = game_loader.getRandomKey();
game_random_key_other = game_loader.getRandomKeyOther();
game_loader.setGameOnAde(this);
} else {
game_random_key = 29092007 /* 0x1BBE8A7 */;
game_random_key_other = 11081984 /* 0xA91900 */;
Stage.scaleMode = "noScale";
if (website != "fizzy") {
Stage.scaleMode = "showAll";
}
}
game_loaded = false;
game_width = _gw;
game_height = _gh;
game_language = _game_lang;
game_played_num = 0;
game_highest_score = 0;
bt = (bl = 0);
GameLoader.display_info("[Game] - game_random_key: " + game_random_key);
}
function setGameUrl(_S) {
game_url = _S;
}
function getGameUrl() {
return(game_url);
}
function getGameType() {
return(game_type);
}
function getGameMainContainer() {
return(game_main_container);
}
function setSecretKey(_S) {
secret_key = _S;
}
function getSecretKey() {
return(secret_key);
}
function getGamePlayedNum() {
return(game_played_num);
}
function getGameTime() {
return(game_time);
}
function getGameLanguage() {
return(game_language);
}
function getHighestScore() {
return(game_highest_score);
}
function setHighestScore(_N) {
game_highest_score = Math.max(_N, game_highest_score);
}
function getFPSAVG() {
return(fps_average);
}
function checkUrl(_FRAME) {
if (_FRAME == undefined) {
_FRAME = "illegal";
}
CheckUrl.checkThisUrl(_url, game_mc, _FRAME);
}
function timerStart() {
GameTimer.start();
}
function timerStop() {
GameTimer.stop();
}
function timerReset() {
GameTimer.reset();
game_time = 0;
}
function timerGetTime() {
return(GameTimer.getGameTime());
}
function startFpsRecording(_F, _L) {
fps_interval_freq = (_F ? (_F) : (FPS_FREQ));
fps_recorder_length = (_L ? (_L) : (FPS_LENGTH));
fps_last_row_num = 0;
fps_recorder = new Array();
fps_average = 0;
GameLoader.display_info((("[startFpsRecording]: fps_interval_freq>" + fps_interval_freq) + " fps_recorder_length>") + fps_recorder_length);
}
function startFPS() {
FPSCounter.startInvisible(game_mc, -50001);
if (game_type == GAME_PRIVATE) {
fps_interval = setInterval(fpsRecorder, fps_interval_freq, this);
}
}
function stopFPS() {
FPSCounter.stop(game_mc);
clearInterval(fps_interval);
}
function fpsRecorder(_GAME) {
var _local2 = FPSCounter.getLastFPS();
if (_GAME.fps_recorder.length < _GAME.fps_recorder_length) {
_GAME.fps_recorder.push(_local2);
} else {
if (_GAME.fps_last_row_num >= _GAME.fps_recorder_length) {
_GAME.fps_last_row_num = 0;
}
_GAME.fps_recorder[_GAME.fps_last_row_num++] = _local2;
}
}
function getFpsAvg() {
var _local5 = 0;
if (game_type == GAME_PRIVATE) {
var _local4 = 0;
var _local3 = fps_recorder.length;
if (_local3 > 0) {
var _local2 = 0;
while (_local2 < _local3) {
_local4 = _local4 + fps_recorder[_local2];
_local2++;
}
_local5 = Math.round(_local4 / _local3);
GameLoader.display_info("[fpsRecorder]: fps_recorder: " + fps_recorder);
fps_recorder = new Array();
fps_last_row_num = 0;
} else {
_local5 = -1;
}
} else {
_local5 = -2;
}
return(_local5);
}
function setPoints(_P) {
game_points = Xor.endecodeNumber(_P, game_random_key);
game_points_info = _P;
GameLoader.display_info(((((((("\tPOINTS xor: " + game_points) + "(") + Xor.endecodeNumber(game_points, game_random_key)) + ")") + " info:") + game_points_info) + " key:") + game_random_key);
}
function addPoints(_P) {
var _local2 = Math.round(_P);
game_points_info = game_points_info + _local2;
game_points = Xor.endecodeNumber(Xor.endecodeNumber(game_points, game_random_key) + _local2, game_random_key);
GameLoader.display_info(((((("\tPOINTS xor: " + game_points) + "(") + Xor.endecodeNumber(game_points, game_random_key)) + ")") + " info:") + game_points_info);
return(game_points);
}
function getPoints() {
return(game_points);
}
function getPointsInfo() {
return(game_points_info);
}
function getPointsToSave() {
return(Xor.endecodeNumber(game_points, game_random_key));
}
function setSecureValue(_N) {
return(Xor.endecodeNumber(_N, game_random_key_other));
}
function addSecureValue(_NV, _N) {
return(Xor.endecodeNumber(Xor.endecodeNumber(_N, game_random_key_other) + _NV, game_random_key_other));
}
function savePlaytime() {
if (game_type == GAME_PRIVATE) {
timerStop();
game_time = timerGetTime();
game_loader.savePlaytime(game_time);
GameLoader.display_info("[savePlaytime - GameOnAde] game_played_num" + game_played_num);
}
}
function savePoints() {
if (game_type == GAME_PRIVATE) {
game_loader.savePoints();
GameLoader.display_info("[savePoints - GameOnAde] score_saved" + score_saved);
} else {
getURL (game_url, "_self");
}
}
function setScoreSaved(_B) {
score_saved = _B;
if (_B) {
game_played_num = 0;
}
GameLoader.display_info("[setScoreSaved] - score_saved:" + score_saved);
}
function getScoreSaved() {
return(score_saved);
}
function startGame() {
setPoints(0);
if (game_type == GAME_PRIVATE) {
timerReset();
startFPS();
}
}
function endGame() {
if (game_type == GAME_PRIVATE) {
game_played_num++;
fps_average = getFpsAvg();
stopFPS();
savePlaytime();
}
setScoreSaved(false);
GameLoader.display_info((("[endGame] - fps_avg:" + fps_average) + " game_time:") + game_time);
}
function startPreloader(_preloader_name, _clickable) {
if (_clickable == undefined) {
_clickable = true;
}
GameLoader.display_info("[startPreloader] - start");
bt = game_mc.getBytesTotal();
bl = game_mc.getBytesLoaded();
if (_preloader_name == undefined) {
_preloader_name = "gameonade_preloader";
}
preloader_mc = game_mc.attachMovie(_preloader_name, _preloader_name, 25000);
preloader_mc.game = this;
preloader_mc._x = game_width / 2;
preloader_mc._y = game_height / 2;
if (_clickable) {
preloader_mc.onRelease = function () {
getURL (GameOnAde.SITE_URL, "_blank");
};
}
preloader_mc.percentage = 0;
if (game_type == GAME_EXE) {
preloader_mc.bt_txt.text = " ";
} else {
preloader_mc.bt_txt.text = bt;
}
preloader_mc.onEnterFrame = function () {
this.game.bl = this.game.game_mc.getBytesLoaded();
this.percentage = Math.round((this.game.bl * 100) / this.game.bt);
this.bt_txt.text = this.game.bt;
this.bl_txt.text = this.game.bl;
if (this.game.game_type == GameOnAde.GAME_EXE) {
this.preloader_mc.bt_txt.text = " ";
} else {
this.loading_mc.percentage_txt.text = this.percentage + " %";
}
if ((this.game.bl >= this.game.bt) && (this.is_stop)) {
delete this.onEnterFrame;
this.game.game_loaded = true;
this.play();
}
};
}
function centerIt(_mc) {
_mc._x = (game_width / 2) - (_mc._width / 2);
_mc._y = (game_height / 2) - (_mc._height / 2);
}
static var FPS_FREQ = 10000;
static var FPS_LENGTH = 20;
static var GAME_PRIVATE = "private";
static var GAME_PUBLIC = "public";
static var GAME_EXE = "exe";
static var SITE_URL = "http://www.gameonade.com";
}
Symbol 1198 MovieClip [__Packages.GameLoader] Frame 0
class GameLoader
{
var main_swf, game_swf, secret_key, random_key, random_key_other, site_culture, saved_time_id, user, site_domain, game_url, game_id, game_on_ade, game_last_score, translation, game_loader, game_listener;
function GameLoader (_main_swf, _culture, _console) {
if (_console == undefined) {
_console = false;
}
_root.info_txt.selectable = _console;
_root.info_txt._visible = _console;
display_info("[GameLoader] - constructor");
fscommand ("showmenu", false);
Stage.showMenu = false;
Stage.align = "TL";
main_swf = _main_swf;
game_swf = main_swf.createEmptyMovieClip("game_swf", 1);
secret_key = "all_for_one";
random_key = 256 + Math.round(Math.random() * 1000000);
random_key_other = 123 + Math.round(Math.random() * 10000);
site_culture = ((_culture == undefined) ? "en" : (_culture));
saved_time_id = 0;
user = new User();
}
function getDomainName() {
return((site_domain ? (site_domain) : ""));
}
function setGameUrl(_T, _GID, _RAND) {
game_url = (((getDomainName() + GAME_PATH) + _T) + "/") + _GID;
game_url = game_url + (_RAND ? ("/" + Math.round(Math.random() * 100)) : (site_culture));
game_id = _GID;
display_info("\t\t[setGameUrl >> " + game_url);
}
function setSiteDomain(_T) {
site_domain = _T;
}
function getSecretKey() {
return(secret_key);
}
function getRandomKey() {
return(random_key);
}
function getRandomKeyOther() {
return(random_key_other);
}
function getUser() {
return(user);
}
function setGameOnAde(_G) {
game_on_ade = _G;
}
function getGameOnAde() {
return(game_on_ade);
}
function setSavedTimeId(_N) {
saved_time_id = _N;
}
function getSavedTimeId() {
return(saved_time_id);
}
function savePlaytime(_T) {
var _local2 = new LoadVars();
_local2.time = _T;
_local2.game_id = game_id;
var _local3 = new LoadVars();
_local2.sendAndLoad(getDomainName() + GAME_TIME_PATH, _local3, "post");
_local3.game = this;
_local3.onLoad = function (success) {
if (success) {
GameLoader.display_info((("[savePlaytime] ERROR:" + this.error) + " time_id:") + this.time);
this.game.setSavedTimeId(this.time);
} else {
GameLoader.display_info("[savePlaytime] LOADING ERROR");
}
};
}
function savePoints() {
display_info("\n\n\t\tSAVING POINTS\n\n");
var _local2 = getGameOnAde();
game_swf._visible = false;
display_error_window(__i18n("loading"));
if (!_local2.getScoreSaved()) {
if (_local2.getPointsInfo() > 0) {
_local2.setHighestScore(_local2.getPointsInfo());
var _local5 = MD5.getHash(((((_local2.getSecretKey() + String(game_id)) + String(_local2.getGameTime())) + String(_local2.getPointsToSave())) + String(_local2.getFPSAVG())) + secret_key);
display_info((((((((("[GL savePoints] data: \n\t\t game_id:" + game_id) + "\n\t\t _G.getGameTime():") + _local2.getGameTime()) + "\n\t\t G.getPointsToSave():") + _local2.getPointsToSave()) + "\n\t\t _G.getFPSAVG:") + _local2.getFPSAVG()) + " \n\n\t _G.getGamePlayedNum():") + _local2.getGamePlayedNum());
var _local3 = new LoadVars();
_local3.game_id = game_id;
_local3.time = _local2.getGameTime();
game_last_score = (_local3.score = _local2.getPointsInfo());
_local3.fps = _local2.getFPSAVG();
_local3.checksum = _local5;
_local3.time_id = getSavedTimeId();
_local3.played_num = _local2.getGamePlayedNum();
var _local4 = new LoadVars();
_local3.sendAndLoad(getDomainName() + GAME_SCORE_PATH, _local4, "post");
_local4.my_game = _local2;
_local4.game_loader = this;
_local4.onLoad = function (success) {
if (success) {
GameLoader.display_info("[SAVE SCORE TEST] SHOW ERROR:" + this.error);
if (this.error == 0) {
this.my_game.setScoreSaved(true);
this.game_loader.display_scores_window(this.error);
GameLoader.display_info("[saveScore] display table with scores:" + this.error);
} else if (this.error == "SCO1") {
this.game_loader.display_login_window(this.error);
} else {
this.game_loader.display_error_window(((this.game_loader.__i18n(this.error) + " (") + this.error) + ")");
GameLoader.display_info("[saveScore] DISPLAY LOGIN FORM:" + this.error);
}
} else {
this.game_loader.display_error_window(this.game_loader.__i18n("transfer_failed"));
GameLoader.display_info("[saveScore] LOADING ERROR");
}
};
} else {
display_error_window(__i18n("points_zero"));
display_info("[saveScore] POINTS NOT ENOUGH");
}
} else {
display_error_window(__i18n("score_already"));
display_info("[saveScore] SCORE ALREADY SAVED");
}
}
function loadCultureXML() {
translation = new Array();
var _local3 = new XML();
_local3.ignoreWhite = true;
_local3.game_loader = this;
_local3.onLoad = function (success) {
if (success) {
var _local2 = this.firstChild.firstChild.firstChild;
var _local3 = 0;
while (_local2) {
this.game_loader.translation[_local2.nodeName] = _local2.firstChild.nodeValue;
_local2 = _local2.nextSibling;
}
this.game_loader.loadGame();
} else {
GameLoader.display_info("[cultureXML] ERROR WITH RECEIVING CULTURE DATA");
}
};
_local3.load((((GAME_CULTURE_PATH + site_culture) + ".xml") + "?rand=") + Math.round(Math.random() * 100));
}
function __i18n(_S) {
return(translation[_S]);
}
function loadGame() {
display_info("[GameLoader] - LoadGame");
game_loader = new MovieClipLoader();
game_listener = new Object();
game_listener.all = this;
game_loader.addListener(game_listener);
game_loader.loadClip(game_url, game_swf);
main_swf.loading_txt.text = "loading ...";
game_listener.onLoadInit = function (_mc) {
GameLoader.display_info("[GameLoader] - onLoadInit");
};
game_listener.onLoadProgress = function (_mc, bytesLoaded, bytesTotal) {
var _local2 = Math.round((bytesLoaded / bytesTotal) * 100);
this.all.main_swf.loading_txt.text = ("loading " + _local2) + "%";
};
game_listener.onLoadComplete = function (_mc) {
GameLoader.display_info("[GameLoader] - onLoadComplete");
};
game_listener.onLoadStart = function (_mc) {
GameLoader.display_info("[GameLoader] - onLoadStart");
};
game_listener.onLoadError = function () {
GameLoader.display_info("[GameLoader] - onLoadError");
};
}
function getPointsTable(_RANK, _W) {
display_info((("[getPointsTable] Rank:" + _RANK) + " _W:") + _W);
_W.info_txt.text = __i18n("loading_scores");
_W.alltime_btn.bg_mc.gotoAndStop(2);
_W.thisweek_btn.bg_mc.gotoAndStop(2);
_W.today_btn.bg_mc.gotoAndStop(2);
var _local7 = _W[_RANK + "_btn"];
_local7.bg_mc.gotoAndStop(1);
var _local6 = new XML();
_local6.ignoreWhite = true;
_local6.game_loader = this;
_local6.onLoad = function (success) {
if (success) {
var _local5 = new Array();
var _local4 = this.firstChild.firstChild.childNodes;
var _local3 = 0;
while (_local3 < _local4.length) {
_local5[_local3] = new Array();
_local5[_local3].log = ((_local4[_local3].attributes.type == "logged") ? 1 : 0);
var _local2 = _local4[_local3].firstChild;
while (_local2) {
_local5[_local3][_local2.nodeName] = _local2.firstChild.nodeValue;
if (_local4[_local3].attributes.type == "logged") {
if (_local2.nodeName == "id") {
this.game_loader.user.setUserId(_local2.firstChild.nodeValue);
} else if (_local2.nodeName == "lo") {
this.game_loader.user.setUserName(_local2.firstChild.nodeValue);
} else if (_local2.nodeName == "sc") {
this.game_loader.user.setRankPoints(_local2.firstChild.nodeValue);
} else if (_local2.nodeName == "po") {
this.game_loader.user.setRankPosition(_local2.firstChild.nodeValue);
}
}
_local2 = _local2.nextSibling;
}
_local3++;
}
_W.info_txt.text = "";
this.game_loader.displayPointsTable(_local5, _W);
} else {
_W.info_txt.text = this.game_loader.__i18n("transfer_failed");
GameLoader.display_info("[scoreTable] ERROR WITH RECEIVING DATA");
}
};
_local6.load((((((getDomainName() + GAME_SCORE_TABLE_PATH) + game_id) + "/") + _RANK) + "?rand=") + Math.round(Math.random() * 100));
}
function displayPointsTable(_A, _W) {
var _local3 = new Array();
var _local6 = _W.empty_mc.createEmptyMovieClip("cont", 1);
_local6._y = (_local6._x = 1);
var _local1 = new MovieClip();
var _local2 = 0;
while (_local2 < _A.length) {
_local3 = _A[_local2];
_local1 = _local6.attachMovie("score_line", "sl" + _local2, _local2);
_local1._y = _local2 * _local1._height;
_local1.po_txt.text = _local3.po;
_local1.lo_txt.text = _local3.lo;
_local1.sc_txt.text = _local3.sc;
var _local4 = (Number(_local3.po) - 1) % 2;
if (_local4 == 0) {
_local1.bg_mc.gotoAndStop(2);
}
if (_local3.log == 1) {
_local1.bg_mc.gotoAndStop(3);
}
_local2++;
}
}
function display_scores_window(_S) {
var _local2 = display_window("scores");
_local2.alltime_btn.onRelease = function () {
this._parent.game_loader.getPointsTable("alltime", this._parent);
};
_local2.alltime_btn.title_txt.text = __i18n("alltime");
_local2.alltime_btn.bg_mc.gotoAndStop(2);
_local2.thisweek_btn.onRelease = function () {
this._parent.game_loader.getPointsTable("thisweek", this._parent);
};
_local2.thisweek_btn.title_txt.text = __i18n("thisweek");
_local2.thisweek_btn.bg_mc.gotoAndStop(2);
_local2.today_btn.onRelease = function () {
this._parent.game_loader.getPointsTable("today", this._parent);
};
_local2.today_btn.title_txt.text = __i18n("today");
_local2.today_btn.bg_mc.gotoAndStop(2);
getPointsTable("today", _local2);
_local2.battle_btn.onRelease = function () {
this._parent.game_loader.display_battle_window();
};
_local2.battle_btn.title_txt.text = __i18n("butt_challenge");
}
function display_login_window(_S) {
var _local2 = display_window("login");
_local2.error_txt.text = _S;
var _local6 = getGameOnAde();
_local2.username_mc.label_txt.text = __i18n("username");
_local2.username_mc.field_txt.text = __i18n("username");
_local2.password_mc.label_txt.text = __i18n("password");
_local2.password_mc.field_txt.password = true;
_local2.password_mc.field_txt.text = __i18n("password");
_local2.login_btn.onRelease = function () {
var _local5 = this._parent.username_mc.field_txt.text;
var _local4 = this._parent.password_mc.field_txt.text;
this._parent.info_txt.text = this._parent.game_loader.__i18n("wait");
var _local2 = new LoadVars();
_local2.username = _local5;
_local2.uservalue = _local4;
_local2.game_id = this._parent.game_loader.game_id;
var _local3 = new LoadVars();
_local2.sendAndLoad(this._parent.game_loader.getDomainName() + GameLoader.GAME_AUTH_PATH, _local3, "post");
_local3.window_mc = this._parent;
_local3.onLoad = function (success) {
if (success) {
if (this.error == 0) {
this.window_mc.info_txt.text = this.window_mc.game_loader.__i18n("LOGOK");
this.window_mc.game_loader.savePoints();
} else {
this.window_mc.info_txt.text = this.window_mc.game_loader.__i18n(this.error);
}
} else {
this.window_mc.info_txt.text = this.window_mc.game_loader.__i18n("transfer_failed");
}
};
};
_local2.login_btn.title_txt.text = __i18n("butt_login");
_local2.register_btn.gotoAndStop(2);
_local2.register_btn.title_txt.text = __i18n("butt_register");
_local2.register_btn.my_lang = _local6.getGameLanguage();
_local2.register_btn.onRelease = function () {
getURL (((this._parent.game_loader.getDomainName() + "/") + this.my_lang) + GameLoader.GAME_REGISTER_PATH, "_blank");
};
}
function display_battle_window(_S) {
var _local2 = display_window("battle");
_local2.battle_txt.text = ((((__i18n("challenge_desc1") + " ") + game_last_score) + newline) + __i18n("challenge_desc2")) + " ";
clearBattleFields(_local2);
_local2.send_btn.onRelease = function () {
this._parent.game_loader.sendBattleFields(this._parent);
};
_local2.send_btn.title_txt.text = __i18n("butt_send");
}
function sendBattleFields(_W) {
var _local9 = __i18n("email_or_username");
var players_arr = new Array();
var _local3 = 1;
while (_local3 <= 3) {
var _local5 = _W[("player" + _local3) + "_mc"];
var _local2 = _local5.field_txt.text;
if ((((_local2 != "") && (_local2 != " ")) && (_local2 != _local9)) && (_local2.length >= 2)) {
players_arr.push(_local2);
}
_local3++;
}
var _local7 = new LoadVars();
_local7.game_id = game_id;
_local7.score = game_last_score;
_local3 = 0;
while (_local3 < players_arr.length) {
_local7["p" + _local3] = players_arr[_local3];
_local3++;
}
var _local10 = new LoadVars();
_W.info_txt.text = __i18n("sending");
_local10.players_arr = players_arr;
_local10.onLoad = function (success) {
if (success) {
if (this.error == 0) {
var _local5 = _W.game_loader.__i18n("challenge_send") + newline;
var _local6 = this.send;
var _local4 = _local6.split(";");
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2];
if (_local3 >= 0) {
_local5 = _local5 + (this.players_arr[_local3] + newline);
}
_local2++;
}
_W.info_txt.text = _local5;
_W.game_loader.clearBattleFields(_W);
} else {
_W.info_txt.text = _W.game_loader.__i18n(this.error);
}
} else {
_W.info_txt.text = _W.game_loader.__i18n("transfer_failed");
}
};
_local7.sendAndLoad(getDomainName() + GAME_CHALLENGE_PATH, _local10, "post");
}
function clearBattleFields(_W) {
var def_val = __i18n("email_or_username");
var _local3 = 1;
while (_local3 <= 3) {
var _local2 = _W[("player" + _local3) + "_mc"];
_local2.label_txt.text = "";
_local2.field_txt.text = def_val;
_local2.field_txt.onSetFocus = function () {
if (this.text == def_val) {
this.text = "";
}
};
_local2.field_txt.onKillFocus = function () {
if ((this.text == "") || (this.text == " ")) {
this.text = def_val;
}
};
_local3++;
}
}
function display_error_window(_S) {
var _local2 = display_window("error");
_local2.info_txt.text = _S;
}
function display_window(_T) {
var _local3 = _root.attachMovie("window", "my_window", 200);
centerIt(_local3);
_local3.gotoAndStop(_T);
_local3.game_loader = this;
_local3.close_btn.onRelease = function () {
this._parent.game_loader.game_swf._visible = true;
this._parent.removeMovieClip();
};
_local3.move_btn.onPress = function () {
this._parent.startDrag();
};
_local3.move_btn.onRelease = (_local3.move_btn.onReleaseOutside = function () {
this._parent.stopDrag();
});
_local3.title_txt.text = __i18n("title_" + _T);
_local3.info_txt.text = "";
return(_local3);
}
function centerIt(_mc) {
_mc._x = (Stage.width / 2) - (_mc._width / 2);
_mc._y = (Stage.height / 2) - (_mc._height / 2);
}
static function display_info(_S) {
_root.info_txt.text = (_S + newline) + _root.info_txt.text;
trace(_S);
}
static var GAME_PATH = "/show_me_game/";
static var GAME_TIME_PATH = "/game_time_save/";
static var GAME_SCORE_PATH = "/game_score_save/";
static var GAME_AUTH_PATH = "/user_game_authorization/";
static var GAME_SCORE_TABLE_PATH = "/game_score_table/";
static var GAME_REGISTER_PATH = "/register/";
static var GAME_CHALLENGE_PATH = "/challenge/";
static var GAME_CULTURE_PATH = "/swf/translation/";
}
Symbol 1199 MovieClip [__Packages.User] Frame 0
class User
{
var is_auth, user_id, user_name, rank_points, rank_position;
function User () {
GameLoader.display_info("[User] - constructor");
}
function getIsAuth() {
return(is_auth);
}
function getUserId() {
return(user_id);
}
function setUserId(_N) {
user_id = _N;
}
function getUserName() {
return(user_name);
}
function setUserName(_N) {
user_name = _N;
}
function getRankPoints() {
return(rank_points);
}
function setRankPoints(_N) {
rank_points = _N;
}
function getRankPosition() {
return(rank_position);
}
function setRankPosition(_N) {
rank_position = _N;
}
function ifAuth() {
return(true);
}
function setUserRank(_rank_type) {
}
}
Symbol 1200 MovieClip [__Packages.MD5] Frame 0
class MD5
{
function MD5 () {
}
static function getHash(str) {
var _local6 = str2blks_MD5(str);
var _local4 = 1732584193 /* 0x67452301 */;
var _local3 = -271733879;
var _local2 = -1732584194;
var _local1 = 271733878 /* 0x10325476 */;
var _local10;
var _local9;
var _local8;
var _local7;
var _local5 = 0;
while (_local5 < _local6.length) {
_local10 = _local4;
_local9 = _local3;
_local8 = _local2;
_local7 = _local1;
_local4 = ff(_local4, _local3, _local2, _local1, _local6[_local5 + 0], 7, -680876936);
_local1 = ff(_local1, _local4, _local3, _local2, _local6[_local5 + 1], 12, -389564586);
_local2 = ff(_local2, _local1, _local4, _local3, _local6[_local5 + 2], 17, 606105819);
_local3 = ff(_local3, _local2, _local1, _local4, _local6[_local5 + 3], 22, -1044525330);
_local4 = ff(_local4, _local3, _local2, _local1, _local6[_local5 + 4], 7, -176418897);
_local1 = ff(_local1, _local4, _local3, _local2, _local6[_local5 + 5], 12, 1200080426);
_local2 = ff(_local2, _local1, _local4, _local3, _local6[_local5 + 6], 17, -1473231341);
_local3 = ff(_local3, _local2, _local1, _local4, _local6[_local5 + 7], 22, -45705983);
_local4 = ff(_local4, _local3, _local2, _local1, _local6[_local5 + 8], 7, 1770035416);
_local1 = ff(_local1, _local4, _local3, _local2, _local6[_local5 + 9], 12, -1958414417);
_local2 = ff(_local2, _local1, _local4, _local3, _local6[_local5 + 10], 17, -42063);
_local3 = ff(_local3, _local2, _local1, _local4, _local6[_local5 + 11], 22, -1990404162);
_local4 = ff(_local4, _local3, _local2, _local1, _local6[_local5 + 12], 7, 1804603682);
_local1 = ff(_local1, _local4, _local3, _local2, _local6[_local5 + 13], 12, -40341101);
_local2 = ff(_local2, _local1, _local4, _local3, _local6[_local5 + 14], 17, -1502002290);
_local3 = ff(_local3, _local2, _local1, _local4, _local6[_local5 + 15], 22, 1236535329);
_local4 = gg(_local4, _local3, _local2, _local1, _local6[_local5 + 1], 5, -165796510);
_local1 = gg(_local1, _local4, _local3, _local2, _local6[_local5 + 6], 9, -1069501632);
_local2 = gg(_local2, _local1, _local4, _local3, _local6[_local5 + 11], 14, 643717713);
_local3 = gg(_local3, _local2, _local1, _local4, _local6[_local5 + 0], 20, -373897302);
_local4 = gg(_local4, _local3, _local2, _local1, _local6[_local5 + 5], 5, -701558691);
_local1 = gg(_local1, _local4, _local3, _local2, _local6[_local5 + 10], 9, 38016083);
_local2 = gg(_local2, _local1, _local4, _local3, _local6[_local5 + 15], 14, -660478335);
_local3 = gg(_local3, _local2, _local1, _local4, _local6[_local5 + 4], 20, -405537848);
_local4 = gg(_local4, _local3, _local2, _local1, _local6[_local5 + 9], 5, 568446438);
_local1 = gg(_local1, _local4, _local3, _local2, _local6[_local5 + 14], 9, -1019803690);
_local2 = gg(_local2, _local1, _local4, _local3, _local6[_local5 + 3], 14, -187363961);
_local3 = gg(_local3, _local2, _local1, _local4, _local6[_local5 + 8], 20, 1163531501);
_local4 = gg(_local4, _local3, _local2, _local1, _local6[_local5 + 13], 5, -1444681467);
_local1 = gg(_local1, _local4, _local3, _local2, _local6[_local5 + 2], 9, -51403784);
_local2 = gg(_local2, _local1, _local4, _local3, _local6[_local5 + 7], 14, 1735328473);
_local3 = gg(_local3, _local2, _local1, _local4, _local6[_local5 + 12], 20, -1926607734);
_local4 = hh(_local4, _local3, _local2, _local1, _local6[_local5 + 5], 4, -378558);
_local1 = hh(_local1, _local4, _local3, _local2, _local6[_local5 + 8], 11, -2022574463);
_local2 = hh(_local2, _local1, _local4, _local3, _local6[_local5 + 11], 16, 1839030562);
_local3 = hh(_local3, _local2, _local1, _local4, _local6[_local5 + 14], 23, -35309556);
_local4 = hh(_local4, _local3, _local2, _local1, _local6[_local5 + 1], 4, -1530992060);
_local1 = hh(_local1, _local4, _local3, _local2, _local6[_local5 + 4], 11, 1272893353);
_local2 = hh(_local2, _local1, _local4, _local3, _local6[_local5 + 7], 16, -155497632);
_local3 = hh(_local3, _local2, _local1, _local4, _local6[_local5 + 10], 23, -1094730640);
_local4 = hh(_local4, _local3, _local2, _local1, _local6[_local5 + 13], 4, 681279174);
_local1 = hh(_local1, _local4, _local3, _local2, _local6[_local5 + 0], 11, -358537222);
_local2 = hh(_local2, _local1, _local4, _local3, _local6[_local5 + 3], 16, -722521979);
_local3 = hh(_local3, _local2, _local1, _local4, _local6[_local5 + 6], 23, 76029189);
_local4 = hh(_local4, _local3, _local2, _local1, _local6[_local5 + 9], 4, -640364487);
_local1 = hh(_local1, _local4, _local3, _local2, _local6[_local5 + 12], 11, -421815835);
_local2 = hh(_local2, _local1, _local4, _local3, _local6[_local5 + 15], 16, 530742520);
_local3 = hh(_local3, _local2, _local1, _local4, _local6[_local5 + 2], 23, -995338651);
_local4 = ii(_local4, _local3, _local2, _local1, _local6[_local5 + 0], 6, -198630844);
_local1 = ii(_local1, _local4, _local3, _local2, _local6[_local5 + 7], 10, 1126891415);
_local2 = ii(_local2, _local1, _local4, _local3, _local6[_local5 + 14], 15, -1416354905);
_local3 = ii(_local3, _local2, _local1, _local4, _local6[_local5 + 5], 21, -57434055);
_local4 = ii(_local4, _local3, _local2, _local1, _local6[_local5 + 12], 6, 1700485571);
_local1 = ii(_local1, _local4, _local3, _local2, _local6[_local5 + 3], 10, -1894986606);
_local2 = ii(_local2, _local1, _local4, _local3, _local6[_local5 + 10], 15, -1051523);
_local3 = ii(_local3, _local2, _local1, _local4, _local6[_local5 + 1], 21, -2054922799);
_local4 = ii(_local4, _local3, _local2, _local1, _local6[_local5 + 8], 6, 1873313359);
_local1 = ii(_local1, _local4, _local3, _local2, _local6[_local5 + 15], 10, -30611744);
_local2 = ii(_local2, _local1, _local4, _local3, _local6[_local5 + 6], 15, -1560198380);
_local3 = ii(_local3, _local2, _local1, _local4, _local6[_local5 + 13], 21, 1309151649);
_local4 = ii(_local4, _local3, _local2, _local1, _local6[_local5 + 4], 6, -145523070);
_local1 = ii(_local1, _local4, _local3, _local2, _local6[_local5 + 11], 10, -1120210379);
_local2 = ii(_local2, _local1, _local4, _local3, _local6[_local5 + 2], 15, 718787259);
_local3 = ii(_local3, _local2, _local1, _local4, _local6[_local5 + 9], 21, -343485551);
_local4 = addme(_local4, _local10);
_local3 = addme(_local3, _local9);
_local2 = addme(_local2, _local8);
_local1 = addme(_local1, _local7);
_local5 = _local5 + 16;
}
return(((rhex(_local4) + rhex(_local3)) + rhex(_local2)) + rhex(_local1));
}
static function rhex(num) {
var _local3 = "";
var _local1 = 0;
while (_local1 <= 3) {
_local3 = _local3 + (hex_chr.charAt(bitAND(num >> ((_local1 * 8) + 4), 15)) + hex_chr.charAt(bitAND(num >> (_local1 * 8), 15)));
_local1++;
}
return(_local3);
}
static function str2blks_MD5(str) {
var _local4 = ((str.length + 8) >> 6) + 1;
var _local2 = new Array(_local4 * 16);
var _local1;
_local1 = 0;
while (_local1 < (_local4 * 16)) {
_local2[_local1] = 0;
_local1++;
}
_local1 = 0;
while (_local1 < str.length) {
_local2[_local1 >> 2] = _local2[_local1 >> 2] | (str.charCodeAt(_local1) << ((_local1 % 4) * 8));
_local1++;
}
_local2[_local1 >> 2] = _local2[_local1 >> 2] | (128 << ((_local1 % 4) * 8));
_local2[(_local4 * 16) - 2] = str.length * 8;
return(_local2);
}
static function addme(x, y) {
var _local1 = bitAND(x, 65535) + bitAND(y, 65535);
var _local2 = ((x >> 16) + (y >> 16)) + (_local1 >> 16);
return((_local2 << 16) | bitAND(_local1, 65535));
}
static function rol(num, cnt) {
return((num << cnt) | (num >>> (32 - cnt)));
}
static function cmn(q, a, b, x, s, t) {
return(addme(rol(addme(addme(a, q), addme(x, t)), s), b));
}
static function ff(a, b, c, d, x, s, t) {
return(cmn(bitAND(b, c) | bitAND(~b, d), a, b, x, s, t));
}
static function gg(a, b, c, d, x, s, t) {
return(cmn(bitAND(b, d) | bitAND(c, ~d), a, b, x, s, t));
}
static function hh(a, b, c, d, x, s, t) {
return(cmn((b ^ c) ^ d, a, b, x, s, t));
}
static function ii(a, b, c, d, x, s, t) {
return(cmn(c ^ (b | (~d)), a, b, x, s, t));
}
static function bitAND(a, b) {
if ((a < 0) && (b < 0)) {
var _local3 = (a & 1) & (b & 1);
var _local4 = (a >>> 1) & (b >>> 1);
return((_local4 << 1) | _local3);
}
return(a & b);
}
static var hex_chr = "0123456789abcdef";
}
Symbol 1201 MovieClip [__Packages.CheckUrl] Frame 0
class CheckUrl
{
function CheckUrl () {
}
static function checkThisUrl(_curl, _mc, _frame) {
var _local7 = "www.";
var _local11 = "http://";
var _local2 = false;
var _local3 = _curl;
var _local8 = 0;
var _local9 = new String();
var _local10 = new String();
var _local1 = 0;
while (_local1 < urls.length) {
if (_local3.indexOf(("http://" + urls[_local1]) + "/") != -1) {
_local2 = true;
} else if (_local3.indexOf(("." + urls[_local1]) + "/") != -1) {
_local2 = true;
}
_local1++;
}
if (!_local2) {
_mc.gotoAndStop(_frame);
_mc._alpha = 0;
delete _mc.onEnterFrame;
var _local6 = _mc.createEmptyMovieClip("error_mc", 63033);
var _local4 = _local6.createTextField("my_txt", 1, 0, 0, 250, 190);
_local4.wordWrap = true;
_local4.html = true;
_local4.htmlText = "This copy of the game is illegal.\n\nGame came from <b><a href='http://www.gameonade.com'>www.GameOnade.Com</a></b>.\nNobody should copy this version of game.\n\nCheck on <a href='http://www.gameonade.com'>www.GameOnade.Com</a> - there could be a special copy which is allowed to spread on the other sites.";
centerIt(_local6);
trace("bad site");
} else {
trace("good site");
}
}
static function centerIt(_mc) {
_mc._x = (Stage.width / 2) - (_mc._width / 2);
_mc._y = (Stage.height / 2) - (_mc._height / 2);
}
static var urls = new Array("gameonade.pl", "gameonade.com", "gameonade.eu");
}
Symbol 1202 MovieClip [__Packages.GameTimer] Frame 0
class GameTimer
{
static var startTime;
function GameTimer () {
}
static function start() {
GameLoader.display_info("{GameTimer}[start]");
if (stopped) {
stopped = false;
startTime = getTimer();
}
}
static function stop() {
if (!stopped) {
stopped = true;
if (startTime) {
gameTime = gameTime + (getTimer() - startTime);
}
}
GameLoader.display_info(("{GameTimer}[stop] ( " + gameTime) + " )");
}
static function reset() {
GameLoader.display_info("{GameTimer}[reset]");
gameTime = 0;
}
static function getGameTime() {
return(gameTime);
}
static function isStopped() {
return(stopped);
}
static function setStopped(ns) {
stopped = ns;
}
static var gameTime = 0;
static var stopped = true;
}
Symbol 1203 MovieClip [__Packages.FPSCounter] Frame 0
class FPSCounter
{
static var lastFPS;
function FPSCounter () {
}
static function startInvisible(cont, depth) {
var _local2 = cont.createEmptyMovieClip("fpsCounter", depth);
_local2.lasttime = getTimer();
_local2.onEnterFrame = function () {
FPSCounter.t = getTimer();
if ((FPSCounter.t - this.lastTime) > 0) {
FPSCounter.framerate = Math.round((1000 / (FPSCounter.t - this.lastTime)) * 10) / 10;
FPSCounter.lastFPS = FPSCounter.framerate;
}
this.lastTime = FPSCounter.t;
};
}
static function stop(cont) {
var _local1 = cont.fpsCounter;
_local1.removeMovieClip();
}
static function getLastFPS() {
return(Math.round(lastFPS));
}
}
Symbol 1204 MovieClip [__Packages.Xor] Frame 0
class Xor
{
function Xor () {
}
static function endecodeNumber(num, k) {
return(num ^ k);
}
}
Symbol 1205 MovieClip [__Packages.FizzyAPIas2] Frame 0
class FizzyAPIas2
{
static var instance, bridge, userGameData, userDetails;
var game, callbacks;
function FizzyAPIas2 (mc) {
game = mc;
game._lockroot = true;
intervalId = setInterval(this, "interfaceInterval", 100);
callbacks = new Object();
}
static function initialize(mc, initCallback, callbackScope) {
trace("FizzyAPI.initialize");
com.gskinner.utils.SWFBridgeAS2.prototype.changeID = function (p_id) {
this.lc.close();
this._connected = false;
this.baseID = p_id.split(":").join("");
this.host = this.lc.connect(this.baseID + "_host");
this.myID = this.baseID + (this.host ? "_host" : "_guest");
this.extID = this.baseID + (this.host ? "_guest" : "_host");
if (!this.host) {
this.lc.connect(this.myID);
this.lc.send(this.extID, "com_gskinner_utils_SWFBridge_init");
}
};
if (instance == null) {
instance = new FizzyAPIas2(mc);
instance.setCallback("init", initCallback, callbackScope);
}
}
static function clear() {
var _local3 = bridge;
delete instance;
initialized = false;
instance = null;
bridge = null;
for (var _local2 in _global) {
delete _global[_local2];
}
return(_local3);
}
static function setPlayListener(callback, callbackScope) {
if (!initialized) {
return(undefined);
}
if (callback == null) {
callback = function () {
FizzyAPIas2.reloadGame();
};
}
instance.setCallback("playGame", callback, callbackScope);
}
static function setGameDataListener(onData, thisObj) {
instance.setCallback("gameDataResult", onData, thisObj);
}
static function saveGameData(data, dataName) {
if (!initialized) {
if (System.capabilities.playerType == "External") {
instance.executeCallback("gameDataResult", true);
}
return(undefined);
}
if ((dataName == undefined) || (dataName == null)) {
dataName = "data";
}
userGameData[dataName] = data;
bridge.send("saveGameData", dataName, data);
}
static function getGameData(dataName) {
if (!initialized) {
return(null);
}
if ((dataName == undefined) || (dataName == null)) {
dataName = "data";
}
return(((userGameData[dataName] != undefined) ? (userGameData[dataName]) : null));
}
static function getUserDetails() {
if (!initialized) {
return(null);
}
return(userDetails);
}
static function getUserId() {
if (!initialized) {
return(0);
}
return(userDetails.id);
}
static function getUsername() {
if (!initialized) {
return("");
}
return(userDetails.username);
}
static function getAvatar() {
if (!initialized) {
return("");
}
return(userDetails.avatar);
}
static function log(arg) {
trace(arg);
}
static function getGamePath() {
trace("FizzyAPI.getGamePath");
if (!initialized) {
return("");
}
var _local2 = _root._url.lastIndexOf("/");
return(_root._url.substr(0, _local2 + 1));
}
static function isDemo() {
trace("FizzyAPI.isDemo");
if (!initialized) {
return(System.capabilities.playerType != "External");
}
if (demoCodes == null) {
return(true);
}
if (demoCodes.length != 2) {
return(true);
}
var _local1 = instance.getRecursive(demoCodes[0]);
var _local2 = instance.getRecursive(demoCodes[1]);
return(Boolean(((_local1 != _local2) || (_local1 <= 0)) || (_local2 <= 0)));
}
static function reloadGame() {
trace("FizzyAPI.reloadGame");
if (!initialized) {
return(undefined);
}
var _local1 = clear();
_local1.send("reloadGame");
_local1.close();
}
static function openDeveloperPage() {
trace("FizzyAPI.openDeveloperPage");
if (!initialized) {
return(undefined);
}
bridge.send("openDeveloperPage");
}
static function openMoregamesPage() {
trace("FizzyAPI.openMoregamesPage");
if (!initialized) {
return(undefined);
}
bridge.send("openMoregamesPage");
}
static function openGamePage() {
trace("FizzyAPI.openGamePage");
if (!initialized) {
return(undefined);
}
bridge.send("openGamePage");
}
static function submitScore(score, callback, callbackScope) {
trace("FizzyAPI.submitScore");
if (!initialized) {
if (System.capabilities.playerType == "External") {
if ((callback != null) && (callbackScope != null)) {
callback.apply(callbackScope, [true]);
} else if (callback != null) {
callback(true);
}
return(undefined);
}
return(undefined);
}
instance.setCallback("submitResult", callback, callbackScope);
bridge.send("submitScore", score);
}
static function showCredits() {
trace("FizzyAPI.showCredits");
if (!initialized) {
return(undefined);
}
bridge.send("showCredits");
}
static function showGameover(score) {
trace("FizzyAPI.showGameover");
if (!initialized) {
return(undefined);
}
bridge.send("showGameover", score);
}
function interfaceInterval() {
if (System.capabilities.playerType == "External") {
bridge.close();
clearInterval(intervalId);
intervalId = 0;
executeCallback("init");
return(undefined);
}
if (game.getBytesLoaded() < game.getBytesTotal()) {
return(undefined);
}
if (bridge == null) {
trace("AS2 creating bridge...");
clearInterval(intervalId);
intervalId = setInterval(this, "interfaceInterval", 2000);
bridge = new com.gskinner.utils.SWFBridgeAS2("fizzyBridge_" + getGameName(), instance);
return(undefined);
}
bridge.close();
if ((game.__fizzyUI_pirate__ != null) && (game.__fizzyUI_pirate__ != undefined)) {
var _local2 = game.getNextHighestDepth() - 1;
if (game.__fizzyUI_pirate__.getDepth() < _local2) {
var _local5 = game.getInstanceAtDepth(_local2);
_local5.swapDepths(game.__fizzyUI_pirate__);
}
} else {
var _local6 = game.createEmptyMovieClip("__fizzyUI_pirate__", game.getNextHighestDepth());
var _local3 = new MovieClipLoader();
var _local4 = new Sound();
_local4.setVolume(0);
_local3.loadClip("http://www.fizzy.com/swf/gls/pirate.swf", _local6);
}
}
function getGameName() {
var _local2 = _root._url.lastIndexOf("/") + 1;
var _local3 = _root._url.lastIndexOf(".swf");
return(_root._url.substr(_local2, _local3 - _local2));
}
function getRecursive(val) {
if (val == null) {
return(-1);
}
if (typeof(val.next) == "number") {
return(val.next ^ val.mask);
}
return(getRecursive(val.next) ^ val.mask);
}
function setCallback(type, cb, scope) {
callbacks[type] = {procedure:cb, scope:scope};
}
function executeCallback() {
trace("Execute callback");
var _local4 = arguments.slice(0);
var _local6 = String(_local4.shift());
var _local5 = callbacks[_local6].scope;
var _local3 = callbacks[_local6].procedure;
if ((_local5 != null) && (_local3 != null)) {
if (_local4.length == 1) {
_local3.apply(_local5, _local4);
} else {
_local3.apply(_local5);
}
} else if (_local3 != null) {
if (_local4.length == 1) {
_local3(_local4[0]);
} else {
_local3();
}
}
}
function initCompleted(data) {
initialized = true;
setPlayListener(null);
userGameData = data.gameData;
userDetails = data.userDetails;
executeCallback("init");
}
function setGameVars(data) {
if ((intervalId == undefined) || (bridge.id != ("fizzyBridge_" + getGameName()))) {
return(undefined);
}
trace("Setting game vars...");
trace(" data.demo = " + data.demo);
clearInterval(intervalId);
intervalId = undefined;
demoCodes = data.demo;
bridge.changeID(data.newId);
}
static var initialized = false;
static var demoCodes = null;
var intervalId = undefined;
}
Symbol 1206 MovieClip [__Packages.com.gskinner.utils.SWFBridgeAS2] Frame 0
class com.gskinner.utils.SWFBridgeAS2
{
var baseID, lc, clientObj, host, myID, extID, dispatchEvent;
function SWFBridgeAS2 (p_id, p_clientObj) {
mx.events.EventDispatcher.initialize(this);
baseID = p_id.split(":").join("");
lc = new LocalConnection();
var _this = this;
lc.com_gskinner_utils_SWFBridge_init = function () {
_this.com_gskinner_utils_SWFBridge_init();
};
lc.com_gskinner_utils_SWFBridge_receive = function () {
_this.com_gskinner_utils_SWFBridge_receive.apply(_this, arguments);
};
clientObj = p_clientObj;
host = lc.connect(baseID + "_host");
myID = baseID + (host ? "_host" : "_guest");
extID = baseID + (host ? "_guest" : "_host");
if (!host) {
lc.connect(myID);
lc.send(extID, "com_gskinner_utils_SWFBridge_init");
}
}
function close() {
lc.close();
delete clientObj;
delete lc;
_connected = false;
}
function send() {
if (!_connected) {
return(undefined);
}
var _local3 = arguments.slice(0);
_local3.unshift("com_gskinner_utils_SWFBridge_receive");
_local3.unshift(extID);
lc.send.apply(lc, _local3);
}
function get id() {
return(baseID);
}
function get connected() {
return(_connected);
}
function com_gskinner_utils_SWFBridge_receive() {
var _local3 = arguments.slice(0);
var _local4 = String(_local3.shift());
clientObj[_local4].apply(clientObj, _local3);
}
function com_gskinner_utils_SWFBridge_init() {
trace("SWFBridge (AS2) connected as " + (host ? "host" : "client"));
if (host) {
lc.send(extID, "com_gskinner_utils_SWFBridge_init");
}
_connected = true;
dispatchEvent({type:"connect"});
}
var _connected = false;
}
Symbol 1207 MovieClip [__Packages.mx.events.EventDispatcher] Frame 0
class mx.events.EventDispatcher
{
function EventDispatcher () {
}
static function _removeEventListener(queue, event, handler) {
if (queue != undefined) {
var _local4 = queue.length;
var _local1;
_local1 = 0;
while (_local1 < _local4) {
var _local2 = queue[_local1];
if (_local2 == handler) {
queue.splice(_local1, 1);
return(undefined);
}
_local1++;
}
}
}
static function initialize(object) {
if (_fEventDispatcher == undefined) {
_fEventDispatcher = new mx.events.EventDispatcher();
}
object.addEventListener = _fEventDispatcher.addEventListener;
object.removeEventListener = _fEventDispatcher.removeEventListener;
object.dispatchEvent = _fEventDispatcher.dispatchEvent;
object.dispatchQueue = _fEventDispatcher.dispatchQueue;
}
function dispatchQueue(queueObj, eventObj) {
var _local7 = "__q_" + eventObj.type;
var _local4 = queueObj[_local7];
if (_local4 != undefined) {
var _local5;
for (_local5 in _local4) {
var _local1 = _local4[_local5];
var _local3 = typeof(_local1);
if ((_local3 == "object") || (_local3 == "movieclip")) {
if (_local1.handleEvent != undefined) {
_local1.handleEvent(eventObj);
}
if (_local1[eventObj.type] != undefined) {
if (exceptions[eventObj.type] == undefined) {
_local1[eventObj.type](eventObj);
}
}
} else {
_local1.apply(queueObj, [eventObj]);
}
}
}
}
function dispatchEvent(eventObj) {
if (eventObj.target == undefined) {
eventObj.target = this;
}
this[eventObj.type + "Handler"](eventObj);
dispatchQueue(this, eventObj);
}
function addEventListener(event, handler) {
var _local3 = "__q_" + event;
if (this[_local3] == undefined) {
this[_local3] = new Array();
}
_global.ASSetPropFlags(this, _local3, 1);
_removeEventListener(this[_local3], event, handler);
this[_local3].push(handler);
}
function removeEventListener(event, handler) {
var _local2 = "__q_" + event;
_removeEventListener(this[_local2], event, handler);
}
static var _fEventDispatcher = undefined;
static var exceptions = {move:1, draw:1, load:1};
}
Symbol 118 MovieClip [__Packages.com.newgrounds.components.PreloaderBar] Frame 0
class com.newgrounds.components.PreloaderBar extends MovieClip
{
var gotoAndStop, _totalframes, FRAME_TIME, intervalId, time, bar;
function PreloaderBar () {
super();
}
function onLoad() {
_root.stop();
var _local3 = com.newgrounds.API.getPercentLoaded();
if (_local3 == 100) {
if (AUTO_PLAY) {
startMovie();
} else {
gotoAndStop(_totalframes);
}
} else {
advanceFrame(this, false, false);
FRAME_TIME = 1000 / FRAME_RATE;
loadingComplete = false;
intervalId = setInterval(this, "timerHandler", FRAME_TIME / 2);
frameAccum = 0;
time = getTimer();
timerHandler();
}
}
function timerHandler() {
if (!loadingComplete) {
var _local4 = com.newgrounds.API.getPercentLoaded();
bar._xscale = _local4;
if (_local4 == 100) {
loadingComplete = true;
if (AUTO_PLAY) {
startMovie();
}
return(undefined);
}
}
var _local3 = getTimer() - time;
time = time + _local3;
frameAccum = frameAccum + _local3;
var _local2 = 0;
while ((frameAccum >= FRAME_TIME) && (_local2 < MAX_FRAME_SKIP)) {
if (loadingComplete) {
advanceFrame(this, false, false);
}
(frameAccum = frameAccum - FRAME_TIME);
_local2++;
}
updateAfterEvent();
}
function advanceFrame(clip, recurse, loop) {
if (!clip) {
return(undefined);
}
clip.stop();
if (clip._currentframe == clip._totalframes) {
if (loop) {
clip.gotoAndStop(1);
}
} else {
clip.nextFrame();
}
if (recurse) {
for (var _local5 in clip) {
if (typeof(clip[_local5]) == "movieclip") {
advanceFrame(clip[_local5], recurse, loop);
}
}
}
}
function startMovie() {
clearInterval(intervalId);
_root.play();
}
static var symbolName = "preloaderBar";
static var symbolOwner = "com.newgrounds.API";
var AUTO_PLAY = false;
var FRAME_RATE = 30;
var MAX_FRAME_SKIP = 5;
var loadingComplete = false;
var frameAccum = 0;
}
Symbol 150 MovieClip [__Packages.com.newgrounds.APIError] Frame 0
class com.newgrounds.APIError
{
var message, name, alias;
function APIError (error, msg) {
if (Number(error).toString() == String(error)) {
error = Number(error);
} else if (error_codes[String(error)]) {
error = error_codes[String(error)];
} else {
error = 0;
}
code = error;
message = msg;
name = error_names[error];
alias = aliases[error];
}
static function init_codes() {
var _local2 = new Object();
var _local1 = 0;
while (_local1 < aliases.length) {
_local2[aliases[_local1]] = _local1;
_local1++;
}
return(_local2);
}
static function init_names() {
var _local5 = new Array();
var _local3 = 0;
while (_local3 < aliases.length) {
var _local2 = aliases[_local3].toLowerCase().split("_");
var _local1 = 0;
while (_local1 < _local2.length) {
_local2[_local1] = _local2[_local1].substr(0, 1).toUpperCase() + _local2[_local1].substr(1, _local2[_local1].length);
for (var _local4 in always_caps) {
if (_local2[_local1].toUpperCase() == always_caps[_local4]) {
_local2[_local1] = _local2[_local1].toUpperCase();
}
}
_local1++;
}
_local5[_local3] = _local2.join(" ");
_local3++;
}
return(_local5);
}
function isError() {
return(true);
}
static var aliases = new Array("UNKNOWN_ERROR", "INVALID_API_ID", "MISSING_PARAM", "INVALID_STAT_ID", "INVALID_COMMAND_ID", "FLASH_ADS_NOT_APPROVED", "PERMISSION_DENIED", "IDENTIFICATION_REQUIRED", "INVALID_EMAIL_ADDRESS", "BANNED_USER", "SESSION_EXPIRED", "INVALID_SCORE", "INVALID_MEDAL", "INVALID_SAVE_GROUP", "FILE_NOT_FOUND", "SITE_ID_REQUIRED", "UPLOAD_IN_PROGRESS", "USER_CANCELLED", "CONFIRM_REQUEST", "ILLEGAL_REQUEST", "CONNECTION_FAILED", "QUERY_INCOMPLETE", "SAVE_FILE_ERROR", "INVALID_VALUE", "SERVER_ERROR", "INVALID_SCOREBOARD");
static var always_caps = new Array("API", "URL", "ID");
static var error_codes = init_codes();
static var error_names = init_names();
var code = 0;
}
Symbol 151 MovieClip [__Packages.com.newgrounds.API] Frame 0
class com.newgrounds.API
{
static var version, user_email, movie_id, debug, session_id, connected, tracker_id, user_id, user_name, timeout, encryption_key, host, remote_auth, ad_url, eventDispatcher, last_command, ad_swf_url;
function API () {
}
static function setVersion(v) {
version = v;
}
static function setUserEmail(e) {
user_email = e;
}
static function setFakeSession(fake) {
fake_session = fake;
}
static function setPreload(p) {
preload = p;
}
static function getPercentLoaded() {
var _local2;
if (preload && (preload_items > 0)) {
_local2 = 80;
var _local4 = Math.round((preload_items_loaded / preload_items) * 20);
var _local3 = Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * _local2) + _local4;
} else {
_local2 = 100;
var _local3 = Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * _local2);
}
return(_local3);
}
static function reportNewAsset() {
if (preload) {
preload_items++;
}
}
static function reportAssetLoaded() {
if (preload) {
preload_items_loaded++;
}
}
static function populateMedals(medal_list) {
if (medals === null) {
medals = new Array();
var _local2 = 0;
while (_local2 < medal_list.length) {
var _local1 = medal_list[_local2];
medals.push(new com.newgrounds.Medal(_local1.medal_id, _local1.medal_name, _local1.medal_value, _local1.medal_difficulty, _local1.medal_unlocked, _local1.medal_icon));
_local2++;
}
}
}
static function populateSaveGroups(save_group_list, file_path, image_path) {
com.newgrounds.SaveFile.setFilePath(file_path);
com.newgrounds.SaveFile.setImagePath(image_path);
save_groups = new Array();
var _local6 = 0;
while (_local6 < save_group_list.length) {
var _local2 = save_group_list[_local6];
var _local5 = new com.newgrounds.SaveGroup(_local2.group_id, _local2.group_name, _local2.group_type);
var _local4 = 0;
while (_local4 < _local2.keys.length) {
var _local3 = _local2.keys[_local4];
_local5.addKey(_local3.id, _local3.name, _local3.type);
_local4++;
}
_local4 = 0;
while (_local4 < _local2.ratings.length) {
var _local1 = _local2.ratings[_local4];
_local5.addRating(_local1.id, _local1.name, _local1.min, _local1.max, _local1.float);
_local4++;
}
save_groups.push(_local5);
_local6++;
}
}
static function populateScoreBoards(score_boards) {
scoreboards = new Array();
var _local1 = 0;
while (_local1 < score_boards.length) {
scoreboards.push(new com.newgrounds.ScoreBoard(score_boards[_local1].id, score_boards[_local1].name));
_local1++;
}
}
static function getOfficialURL() {
var _local1 = (((GATEWAY_URL + "?tracker_id=") + movie_id) + "&command_id=loadOfficalVersion&seed=") + Math.random();
if (debug) {
_local1 = _local1 + "&debug=1";
}
return(_local1);
}
static function loadOfficialURL() {
getURL (getOfficialURL(), "_blank");
}
static function hasUserSession() {
if (session_id && (publisher_id)) {
return(true);
}
if (_root.NewgroundsAPI_PublisherID && (_root.NewgroundsAPI_SessionID)) {
return(true);
}
return(false);
}
static function hostIsCompatible() {
return(!(_root.NewgroundsAPI_PublisherID === undefined));
}
static function isNewgrounds() {
return((((publisher_id == 1) || (_root.NewgroundsAPI_PublisherID == 1)) || (getHost().toLowerCase().indexOf("ungrounded.net") > -1)) || (getHost().toLowerCase().indexOf("newgrounds.com") > -1));
}
static function hasPublisher() {
return(publisher_id || (_root.NewgroundsAPI_PublisherID));
}
static function hasUserEmail() {
if (user_email) {
return(true);
}
return(false);
}
static function isConnected() {
return(connected);
}
static function getID() {
return(getTrackerID());
}
static function getTrackerID() {
return(tracker_id);
}
static function getUserID() {
return(user_id);
}
static function getUserName() {
return(user_name);
}
static function connectionTimeOut() {
reportAssetLoaded();
clearInterval(timeout);
callListener(com.newgrounds.APIEvent.API_CONNECTED, false, new com.newgrounds.APIError("CONNECTION_FAILED", "Connection to API gateway timed out."));
}
static function connect(m_id, encrypt_key, debug_mode) {
if (connected) {
return(undefined);
}
sendMessage("Connecting to the Newgrounds API Gateway...");
var _local2 = function () {
com.newgrounds.API.connectionTimeOut();
};
timeout = setInterval(_local2, 10000, null);
if (!m_id) {
fatalError("API.connect() - missing required movie_id parameter", "connect");
}
movie_id = String(m_id);
tracker_id = Number(movie_id.substring(0, movie_id.indexOf(":")));
encryption_key = encrypt_key;
debug = debug_mode;
user_id = 0;
user_name = "Guest";
if (_root.NewgroundsAPI_PublisherID) {
publisher_id = _root.NewgroundsAPI_PublisherID;
if (_root.NewgroundsAPI_SessionID) {
session_id = _root.NewgroundsAPI_SessionID;
}
} else if (fake_session) {
publisher_id = 1;
session_id = "D3bu64p1U53R";
user_id = 10;
user_name = "API-Debugger";
} else {
if (debug) {
publisher_id = 1;
}
session_id = null;
}
if (_root.NewgroundsAPI_UserName) {
user_name = _root.NewgroundsAPI_UserName;
}
if (_root.NewgroundsAPI_UserID) {
user_id = _root.NewgroundsAPI_UserID;
}
if (_root.NewgroundsAPI_UserpageFormat) {
userpage_format = _root.NewgroundsAPI_UserpageFormat;
}
reportNewAsset();
connected = true;
sendCommand("connectMovie", {host:getHost(), movie_version:version});
}
static function getHost() {
if (!host) {
var _local1 = _url;
if ((_local1.toLowerCase().indexOf("http://") > -1) or (_local1.toLowerCase().indexOf("https://") > -1)) {
if (_local1.toLowerCase().indexOf(NEWGROUNDS_PREVIEW) > -1) {
host = NEWGROUNDS_PREVIEW;
} else {
host = _local1.split("/")[2].toLowerCase();
}
} else {
host = LOCAL_HOST;
}
}
return(host);
}
static function isPublishedHost() {
for (var _local1 in PREVIEW_HOSTS) {
if (getHost() == PREVIEW_HOSTS[_local1]) {
return(false);
}
}
return(true);
}
static function loadUserPage(u_id, u_name) {
if ((u_id == undefined) && (u_name == undefined)) {
if (hasUserSession()) {
u_id = user_id;
u_name = user_name;
} else {
return(false);
}
}
if (publisher_id == 1) {
var _local1 = ("http://" + user_name.toLowerCase()) + ".newgrounds.com";
getURL (_local1, "_blank");
return(true);
}
if (userpage_format) {
var _local1 = userpage_format;
_local1 = _local1.split(":user_id:").join(u_id.toString());
_local1 = _local1.split(":user_name:").join(escape(u_name));
getURL (_local1, "_blank");
return(true);
}
return(false);
}
static function loadNewgrounds() {
sendCommand("loadNewgrounds", {host:getHost()}, true);
}
static function loadMySite() {
sendCommand("loadMySite", {host:getHost()}, true);
}
static function loadCustomLink(link) {
sendCommand("loadCustomLink", {host:getHost(), link:link}, true);
}
static function logCustomEvent(event) {
sendCommand("logCustomEvent", {host:getHost(), event:event});
}
static function getScoreBoard(board) {
if ((!scoreboards) || (scoreboards.length < 1)) {
sendWarning("You do not have any scoreboards configured in your API setup.");
return(null);
}
for (var _local2 in scoreboards) {
if ((typeof(board) == "string") && (scoreboards[_local2].name == board)) {
return(scoreboards[_local2]);
}
if ((typeof(board) == "number") && (scoreboards[_local2].id == board)) {
return(scoreboards[_local2]);
}
}
sendWarning(("Could not find any scoreboards named '" + board) + "'.");
return(null);
}
static function postScore(board_name, value, tag) {
var _local3 = getScoreBoard(board_name);
if (tag === undefined) {
tag = "";
}
if (!_local3) {
sendError({command_id:"postScore"}, new com.newgrounds.APIError("INVALID_SCOREBOARD", "Failed to post score. Check the spelling of your board name."));
return(undefined);
}
if (value == undefined) {
sendError({command_id:"postScore"}, new com.newgrounds.APIError("MISSING_PARAM", "Missing score value"));
return(undefined);
}
sendSecureCommand("postScore", {user_name:user_name, board:_local3.id, value:value, tag:tag, publisher_id:publisher_id});
}
static function loadScores(board_name, period, tag) {
var _local3 = "loadScores";
var _local2 = getScoreBoard(board_name);
if (!_local2) {
sendError({command_id:_local3}, new com.newgrounds.APIError("INVALID_SCOREBOARD", "Failed to load scores. Check the spelling of your board name."));
return(undefined);
}
var _local1 = {};
_local1.publisher_id = publisher_id;
_local1.board = _local2.id;
_local1.num_results = _local2.num_results;
_local1.page = _local2.page;
if (period === undefined) {
_local1.period = _local2.period;
} else {
_local1.period = period;
}
if (tag === undefined) {
_local1.tag = _local2.tag;
} else {
_local1.tag = tag;
}
sendCommand(_local3, _local1);
}
static function unlockMedal(medal, x, y) {
if (!medal) {
sendError({command_id:"unlockMedal"}, new com.newgrounds.APIError("MISSING_PARAM", "missing required medal name"));
return(undefined);
}
if (typeof(medal) != "object") {
medal = getMedal(medal);
}
if (!medal) {
sendError({command_id:"unlockMedal"}, new com.newgrounds.APIError("INVALID_MEDAL", "medal unlock failed, check your medal name for correct spelling."));
return(undefined);
}
callListener(com.newgrounds.APIEvent.UNLOCK_MEDAL, true, {medal:medal, x:x, y:y});
if (hasUserSession() or debug) {
sendMessage(("Attempting to unlock '" + medal.getName()) + "'");
var _local3 = new Object();
_local3.medal_id = medal.getID();
sendSecureCommand("unlockMedal", _local3);
} else {
sendMessage(("Unlocking '" + medal.getName()) + "'");
medal.setUnlocked(true);
var _local2 = loadLocal("medals_unlocked");
if (!_local2) {
_local2 = new Object();
}
_local2[medal.getID()] = true;
saveLocal("medals_unlocked", _local2);
}
}
static function loadMedals() {
if (medals) {
callListener(com.newgrounds.APIEvent.MEDALS_LOADED, true, {medals:medals});
return(undefined);
}
var _local1 = new Object();
if (hasUserSession()) {
_local1.publisher_id = publisher_id;
_local1.user_id = user_id;
}
sendCommand("getMedals", _local1);
}
static function getMedals() {
return(medals);
}
static function getMedal(identifier) {
if ((!medals) || (medals.length < 1)) {
sendWarning("You do not have any medals configured on your API setup!");
return(false);
}
for (var _local3 in medals) {
var _local1 = medals[_local3];
if ((typeof(identifier) == "string") && (_local1.getName() == identifier)) {
return(_local1);
}
if (_local1.getID() == identifier) {
return(_local1);
}
}
sendWarning(("Could not find any medals named '" + identifier) + "'.");
return(false);
}
static function saveLocal(save_id, save_data, size_allocation) {
if (!sharedObjects[save_id]) {
sharedObjects[save_id] = SharedObject.getLocal((("ng_ap_secure_" + movie_id) + "_") + save_id);
}
sharedObjects[save_id].data[save_id] = encodeData(save_data);
sharedObjects[save_id].flush();
}
static function loadLocal(save_id) {
if (!sharedObjects[save_id]) {
sharedObjects[save_id] = SharedObject.getLocal((("ng_ap_secure_" + movie_id) + "_") + save_id);
}
sharedObjects[save_id].flush();
echo((("sharedobject " + save_id) + " is: ") + sharedObjects[save_id].data[save_id]);
if (sharedObjects[save_id].data[save_id]) {
echo("decoded: " + decodeData(sharedObjects[save_id].data[save_id]));
return(decodeData(sharedObjects[save_id].data[save_id]));
}
return(null);
}
static function encodeData(data) {
return(compressHex(com.newgrounds.encoders.RC4.encrypt(com.newgrounds.encoders.JSON.encode(data), encryption_key)));
}
static function decodeData(base) {
return(com.newgrounds.encoders.JSON.decode(com.newgrounds.encoders.RC4.decrypt(uncompressHex(base), encryption_key)));
}
static function compressHex(hex_value) {
var _local6 = hex_value.length % 6;
var _local4 = "";
var _local5 = new com.newgrounds.encoders.BaseN(compression_radix);
var _local1 = 0;
while (_local1 < hex_value.length) {
var _local2 = Number("0x" + hex_value.substr(_local1, 6));
_local4 = _local4 + _local5.encode(_local2, 4);
_local1 = _local1 + 6;
}
return(_local6 + _local4);
}
static function uncompressHex(base_value) {
var _local9 = Number(base_value.charAt(0));
var _local7 = "";
var _local3;
var _local8 = new com.newgrounds.encoders.BaseN(compression_radix);
var _local2 = 1;
while (_local2 < base_value.length) {
var _local6 = base_value.substr(_local2, 4);
var _local5 = _local8.decode(_local6);
var _local1 = dec2hex(_local5);
if ((_local2 + 4) < base_value.length) {
_local3 = 6;
} else {
_local3 = _local9;
}
while (_local1.length < _local3) {
_local1 = "0" + _local1;
}
_local7 = _local7 + _local1;
_local2 = _local2 + 4;
}
return(_local7);
}
static function dec2hex(dec) {
var _local4 = "0123456789ABCDEF";
var _local3 = "";
while (dec > 0) {
var _local2 = dec % 16;
_local3 = _local4.charAt(_local2) + _local3;
dec = (dec - _local2) / 16;
}
return(_local3);
}
static function getSaveGroup(group) {
if ((save_groups == null) || (save_groups.length < 1)) {
sendWarning("You do not have any save groups configured in your API setup!");
return(null);
}
var _local1 = 0;
while (_local1 <= save_groups.length) {
if ((typeof(group) == "number") or (Number(group).toString() == String(group))) {
if (save_groups[_local1].getID() == Number(group)) {
return(save_groups[_local1]);
}
} else if (typeof(group) == "string") {
if (save_groups[_local1].getName().toLowerCase() == group.toLowerCase()) {
return(save_groups[_local1]);
}
}
_local1++;
}
sendWarning(("Could not find any save groups named '" + group) + "'.");
return(null);
}
static function getCurrentSaveFile() {
return(save_file);
}
static function setCurrentSaveFile(current) {
save_file = current;
}
static function loadSaveFile(save_id, get_contents) {
if (get_contents === undefined) {
get_contents = true;
}
var _local1 = "loadSaveFile";
var _local2 = {publisher_id:publisher_id, save_id:save_id, get_contents:get_contents};
save_file = null;
sendCommand(_local1, _local2);
}
static function loadFilesByDate(group_name, sort_descending, key_name, key_value) {
if (sort_descending === undefined) {
sort_descending = true;
}
var _local2 = getSaveGroup(group_name);
if (!_local2) {
var _local3 = new com.newgrounds.APIError("QUERY_INCOMPLETE", "The query could not be preformed, check the spelling of your save group name.");
sendError({command_id:"loadFilesByDate"}, _local3);
return(undefined);
}
var _local1 = new com.newgrounds.SaveGroupQuery(_local2);
if (key_name) {
_local1.addKeyCondition(key_name, "=", key_value);
}
_local1.sortOn("CREATED_ON", (sort_descending ? "DESC" : "ASC"));
_local1.execute();
}
static function loadFilesByViews(group_name, sort_descending, key_name, key_value) {
if (sort_descending === undefined) {
sort_descending = true;
}
var _local2 = getSaveGroup(group_name);
if (!_local2) {
var _local3 = new com.newgrounds.APIError("QUERY_INCOMPLETE", "The query could not be preformed, check the spelling of your save group name.");
sendError({command_id:"loadFilesByViews"}, _local3);
return(undefined);
}
var _local1 = new com.newgrounds.SaveGroupQuery(_local2);
if (key_name) {
_local1.addKeyCondition(key_name, "=", key_value);
}
_local1.sortOn("TOTAL_VIEWS", (sort_descending ? "DESC" : "ASC"));
_local1.execute();
}
static function loadFilesByRating(group_name, rating_name, sort_descending, key_name, key_value) {
if (sort_descending === undefined) {
sort_descending = true;
}
var _local2 = getSaveGroup(group_name);
if (!_local2) {
var _local3 = new com.newgrounds.APIError("QUERY_INCOMPLETE", "The query could not be preformed, check the spelling of your save group name.");
sendError({command_id:"loadFilesByRating"}, _local3);
return(undefined);
}
var _local1 = new com.newgrounds.SaveGroupQuery(_local2);
if (key_name) {
_local1.addKeyCondition(key_name, "=", key_value);
}
_local1.sortOnRating(rating_name, (sort_descending ? "DESC" : "ASC"), "score");
_local1.execute();
}
static function lookupSaveFiles(save_group) {
var _local1 = "lookupSaveFiles";
var _local2 = {publisher_id:publisher_id, group_id:save_group.getID(), query:com.newgrounds.encoders.JSON.encode(save_group.getQuery(true))};
sendCommand(_local1, _local2);
}
static function newSaveFile(group) {
var _local1 = getSaveGroup(group);
if (_local1) {
return(_local1.newFile());
}
var _local2 = new com.newgrounds.APIError("INVALID_SAVE_GROUP", "You can not create new files in invalid groups.");
sendError({command_id:"newSaveFile"}, _local2);
}
static function newSaveQuery(group) {
var _local1 = getSaveGroup(group);
if (_local1) {
return(_local1.newQuery());
}
var _local2 = new com.newgrounds.APIError("INVALID_SAVE_GROUP", ("'" + group) + "' is not a valid save group.");
sendError({command_id:"newSaveQuery"}, _local2);
}
static function checkFilePrivs(file) {
if (user_id) {
var _local1 = user_id;
} else {
var _local1 = 0;
}
var _local2 = {group:file.getGroup().getID(), filename:file.getName(), user_id:_local1, publisher_id:publisher_id};
sendCommand("checkFilePrivs", _local2);
}
static function saveFile(file, overwrite) {
var _local1;
_local1 = {group:file.getGroup().getID(), filename:file.getName(), description:file.getDescription(), draft:file.__get__draft(), user_name:user_name};
if (overwrite) {
_local1.overwrite = overwrite;
}
if (file.getDuplicateID()) {
_local1.save_id = file.getDuplicateID();
}
if (file.getKeys().length > 0) {
_local1.keys = file.getKeys();
}
var _local3;
_local3 = {file:file.getRawContents()};
if (file.getThumbnailImageScan()) {
_local3.thumbnail = file.getThumbnailImageScan();
}
save_file = file;
sendSecureCommand("saveFile", _local1, null, _local3);
}
static function rateSaveFile(file, rating, vote) {
var _local1 = {group:file.getGroup().getID(), save_id:file.getID(), rating_id:rating.rating_id, vote:vote, user_id:user_id};
sendSecureCommand("rateSaveFile", _local1);
}
static function getConfirmation(command_name, event, msg, target, confirm, cancel) {
var _local1 = new com.newgrounds.APIError("CONFIRM_REQUEST", msg);
_local1.confirm = function () {
target[confirm]();
};
_local1.cancel = function () {
target[cancel]();
};
_local1.command = command_name;
callListener(event, false, _local1);
}
static function onRemoteAuthentication(auth_result) {
var _local1 = com.newgrounds.encoders.JSON.decode(com.newgrounds.encoders.RC4.decrypt(auth_result, encryption_key));
delete remote_auth;
user_id = _local1.NewgroundsAPI_UserID;
user_name = _local1.NewgroundsAPI_UserName;
session_id = _local1.NewgroundsAPI_SessionID;
publisher_id = _local1.NewgroundsAPI_PublisherID;
}
static function doEvent(e) {
switch (e.command_id) {
case "connectMovie" :
clearInterval(timeout);
sendMessage("You have successfully connected to the Newgrounds API Gateway");
sendMessage(("Movie identified as \"" + e.movie_name) + "\"");
callListener(com.newgrounds.APIEvent.API_CONNECTED, e.success, {title:e.movie_name});
var _local7 = false;
if (e.ad_status === -1) {
var _local11 = "This movie was not approved to run Flash Ads.";
sendWarning(_local11);
sendWarning(("visit " + AD_TERMS_URL) + " to view our approval guidelines");
if (!e.ad_url) {
callListener(com.newgrounds.APIEvent.ADS_APPROVED, false, new com.newgrounds.APIError("FLASH_ADS_NOT_APPROVED", _local11));
} else {
_local7 = true;
}
} else if (e.ad_status === 0) {
var _local11 = "Flash Ads are currently awaiting approval.";
sendNotice(_local11);
if (!e.ad_url) {
callListener(com.newgrounds.APIEvent.ADS_APPROVED, false, new com.newgrounds.APIError("FLASH_ADS_NOT_APPROVED", _local11));
} else {
_local7 = true;
}
}
if (e.ad_url) {
ad_url = unescape(e.ad_url);
if (!_local7) {
sendMessage("This movie has been approved to run Flash Ads!");
}
callListener(com.newgrounds.APIEvent.ADS_APPROVED, true);
}
if (e.deny_host) {
var _local11 = getHost() + " does not have permission to run this movie!";
sendWarning(_local11);
sendWarning("\tUpdate your API configuration to unblock " + getHost());
callListener(com.newgrounds.APIEvent.HOST_BLOCKED, true, {real_url:unescape(e.movie_url), url:getOfficialURL()});
} else if (e.movie_version) {
sendWarning("According to your API Configuration, this version is out of date.");
if (version) {
sendWarning("\tThe this movie is version " + version);
}
sendWarning("\tThe most current version is " + e.movie_version);
callListener(com.newgrounds.APIEvent.NEW_VERSION_AVAILABLE, true, {version:e.movie_version, real_url:unescape(e.movie_url), url:getOfficialURL()});
}
if (e.request_portal_url) {
sendCommand("setPortalID", {portal_url:_url});
}
if (preload) {
reportNewAsset();
var _local8 = {};
if (hasUserSession()) {
_local8.publisher_id = publisher_id;
_local8.user_id = user_id;
}
sendCommand("preloadSettings", _local8);
}
reportAssetLoaded();
break;
case "preloadSettings" :
if (e.medals) {
populateMedals(e.medals);
if ((!hasUserSession()) and (!debug)) {
echo("checking for sharedobject medals...");
var _local4 = loadLocal("medals_unlocked");
if (_local4) {
for (var _local32 in _local4) {
var _local32 = Number(_local32);
if (_local4[_local32]) {
var _local3 = getMedal(_local32);
echo("now unlocking " + _local3.getName());
_local3.setUnlocked(true);
}
}
}
}
}
if (e.save_groups) {
populateSaveGroups(e.save_groups, e.save_file_path);
}
if (e.score_boards) {
populateScoreBoards(e.score_boards);
}
if (_root.NewgroundsAPI_SaveFileID && (_root.NewgroundsAPI_SaveGroupID)) {
callListener(com.newgrounds.APIEvent.FILE_REQUESTED, true, {save_id:_root.NewgroundsAPI_SaveFileID, group:getSaveGroup(_root.NewgroundsAPI_SaveGroupID)});
}
callListener(com.newgrounds.APIEvent.METADATA_LOADED, true);
reportAssetLoaded();
break;
case "logCustomEvent" :
if (e.success) {
sendMessage(("Event '" + e.event) + "' was logged.");
}
callListener(com.newgrounds.APIEvent.EVENT_LOGGED, e.success, {event:e.event});
break;
case "postScore" :
var _local9;
if (e.success) {
var _local5 = "User";
if (user_email) {
_local5 = user_email;
} else if (user_name) {
_local5 = user_name;
}
var _local19 = getScoreBoard(e.board);
sendMessage(((((_local5 + " posted ") + e.value) + " to '") + _local19.name) + "'");
_local9 = {board:_local19, value:e.value, username:_local5};
}
callListener(com.newgrounds.APIEvent.SCORE_POSTED, e.success, _local9);
break;
case "loadScores" :
_local9 = new Object();
var _local19 = getScoreBoard(e.board);
if (_local19.exists()) {
_local19.setScores(e.scores, e.period, e.page, e.num_results);
}
callListener(com.newgrounds.APIEvent.SCORES_LOADED, e.success, {board:_local19});
break;
case "unlockMedal" :
var _local24 = getMedal(e.medal_name);
_local24.setUnlocked(true);
sendMessage(("Successfuly unlocked '" + _local24.getName()) + "'");
callListener(com.newgrounds.APIEvent.MEDAL_UNLOCKED, e.success, {medal_id:_local24.id, medal:_local24});
break;
case "getMedals" :
populateMedals(e.medals);
callListener(com.newgrounds.APIEvent.MEDALS_LOADED, e.success, {medals:medals});
break;
case "loadSaveFile" :
var _local16 = getSaveGroup(e.group_id);
var _local14 = new com.newgrounds.SaveFile(_local16);
_local14.id = e.file.save_id;
_local14.name = e.file.filename;
_local14.fileUrl = e.file.file;
_local14.thumbnailUrl = e.file.thumb;
_local14.authorName = e.file.user_name;
_local14.authorId = e.file.user_id;
_local14.description = e.file.description;
_local14.setPermissions(e.file.status, e.file.locked);
for (var _local6 in e.file.keys) {
_local14.setKey(e.file.keys[_local6].id, e.file.keys[_local6].value);
}
for (var _local6 in e.file.ratings) {
_local14.setRating(e.file.ratings[_local6].id, e.file.ratings[_local6].votes, e.file.ratings[_local6].score);
}
if (e.get_contents) {
_local14.loadContents();
}
callListener(com.newgrounds.APIEvent.FILE_INITIALIZED, e.success, {save_id:_local14.id, file:_local14});
save_file = _local14;
break;
case "lookupSaveFiles" :
var _local12 = getSaveGroup(e.group_id).getQuery();
_local12.onExecuted(e.files);
break;
case "rateSaveFile" :
_local16 = getSaveGroup(e.group_id);
_local14 = _local16.getFile(e.save_id);
if (e.already_voted) {
var _local27 = new com.newgrounds.APIError("PERMISSION_DENIED", "You have already voted on this item today");
callListener(com.newgrounds.APIEvent.VOTE_COMPLETE, false, {error:_local27, file:_local14, save_id:_local14.id});
return(undefined);
}
if (e.success) {
var _local10 = _local14.onVoted(e);
callListener(com.newgrounds.APIEvent.VOTE_COMPLETE, e.success, {rating:_local10, file:_local14, save_id:_local14.id});
} else {
callListener(com.newgrounds.APIEvent.VOTE_COMPLETE, e.success, {file:_local14, save_id:_local14.id});
sendError("Your vote was not accepted.");
}
break;
case "saveFile" :
if (save_file) {
if (!save_file.exists()) {
save_file.setID(e.save_id, true);
}
save_file.onSaved(e);
callListener(com.newgrounds.APIEvent.FILE_SAVED, e.success, {save_id:save_file.__get__id(), file:save_file});
if (e.success) {
sendMessage(((("You just saved a new file (id #" + e.save_id) + ") to the '") + save_file.__get__group().__get__name()) + "' save group.");
}
}
save_file = null;
break;
case "checkFilePrivs" :
_local9 = {file:save_file, filename:e.filename, group:e.group, exists:e.exists, can_write:e.can_write};
if (e.duplicate_id) {
_local9.duplicate_id = e.duplicate_id;
}
if (!e.success) {
sendWarning("You do not have permission to save this file!");
}
callListener(com.newgrounds.APIEvent.FILE_PRIVS_LOADED, e.success, _local9);
}
}
static function getDispatcher() {
if (!eventDispatcher) {
eventDispatcher = new com.newgrounds.APIEventDispatcher();
}
return(eventDispatcher);
}
static function hasEventListener(event) {
return(getDispatcher().hasEventListener(event));
}
static function addEventListener(event, listener, target) {
echo(("Adding a listener for '" + event) + "'");
getDispatcher().addEventListener(event, listener, target);
}
static function removeEventListener(event, target) {
getDispatcher().removeEventListener(event, target);
}
static function callListener(event, success, data, target) {
echo("Fired Event: " + event);
var _local2 = new com.newgrounds.APIEvent(event, success, data);
getDispatcher().dispatchEvent(_local2);
if ((event == com.newgrounds.APIEvent.API_CONNECTED) && (!success)) {
connected = false;
}
bridge.sendEvent(event, {success:success, data:data});
}
static function sendError(c, e) {
switch (c.command_id) {
case "connectMovie" :
clearInterval(timeout);
callListener(com.newgrounds.APIEvent.API_CONNECTED, false, {error:e, response:c});
break;
case "saveFile" :
callListener(com.newgrounds.APIEvent.FILE_SAVED, false, {error:e, file:save_file, response:c});
save_file = null;
}
var _local3 = (((((("[Newgrounds API ERROR] :: " + c.command_id) + "() - ") + e.name) + ":") + newline) + "\t\t\t\t") + e.message;
trace(_local3);
bridge.sendEvent("trace", {data:_local3});
}
static function sendWarning(m, c) {
if (c) {
m = m + ((("\r[Newgrounds API WARNING] :: \tSee " + COMMANDS_WIKI_URL) + c.toLowerCase()) + " for additional information.");
}
var _local1 = "[Newgrounds API WARNING] :: " + m;
trace(_local1);
bridge.sendEvent("trace", {data:_local1});
}
static function sendNotice(m, c) {
if (c) {
m = m + ((("\r[Newgrounds API NOTICE] :: \tSee " + COMMANDS_WIKI_URL) + c.toLowerCase()) + " for additional information.");
}
trace("[Newgrounds API NOTICE] :: " + m);
}
static function fatalError(m, c) {
if (c) {
m = m + ((("\r\tSee " + COMMANDS_WIKI_URL) + c.toLowerCase()) + " for additional information.");
}
throw (((("***ERROR*** frame=" + _root._currentframe) + ", class=API") + newline) + newline) + m;
}
static function openLoginPage() {
if (hasUserSession()) {
return(undefined);
}
if (!remote_auth) {
var _local1 = com.newgrounds.encoders.MD5.calculate((Math.random() + "a") + movie_id);
_local1 = "POOPYPANTS";
remote_auth = new com.newgrounds.RemoteAuth(_local1);
}
var _local2 = com.newgrounds.encoders.RC4.encrypt(remote_auth.__get__token(), encryption_key);
trace(_local2);
getURL ((((LOGIN_URL + "?api_auth_id=") + movie_id) + "&api_auth_key=") + _local2, "_blank");
}
static function sendSecureCommand(command, secure_params, unsecure_params, files) {
if (((!debug) && (!hasUserSession())) && (!hasUserEmail())) {
sendError({command_id:command}, new com.newgrounds.APIError("IDENTIFICATION_REQUIRED", ("You must be logged in, or provide an e-mail address using 'API.setUserEmail(\"name@domain.com\");' to use " + command) + "()."));
return(undefined);
}
if (!command) {
fatalError("Missing command", "sendSecureCommand");
}
if (!secure_params) {
fatalError("Missing secure_params", "sendSecureCommand");
}
if (!unsecure_params) {
unsecure_params = new Object();
}
var _local2 = "";
var _local1 = 0;
while (_local1 < 16) {
_local2 = _local2 + compression_radix.charAt(Math.floor(Math.random() * compression_radix.length));
_local1++;
}
if ((debug && (!fake_session)) && (!session_id)) {
secure_params.session_id = "";
} else {
secure_params.session_id = session_id;
}
secure_params.as_version = 2;
secure_params.user_email = user_email;
secure_params.publisher_id = publisher_id;
secure_params.seed = _local2;
secure_params.command_id = command;
var _local6 = com.newgrounds.encoders.JSON.encode(secure_params);
trace(("JSON: " + _local6) + newline);
var _local9 = com.newgrounds.encoders.MD5.calculate(_local2);
var _local7 = com.newgrounds.encoders.RC4.encrypt(_local6, encryption_key);
var _local8 = _local9 + _local7;
unsecure_params.secure = compressHex(_local8);
sendCommand("securePacket", unsecure_params, false, files);
}
static function sendCommand(command, params, open_browser, files) {
if ((!connected) and (command != "connectMovie")) {
var _local12 = (("API." + command) + "() - API.connect() must be called before this command can be called") + newline;
fatalError(_local12, "connect");
}
if (open_browser) {
var _local2 = new Object();
} else {
var _local2 = new LoadVars();
}
_local2.command_id = command;
_local2.tracker_id = movie_id;
if (debug) {
_local2.debug = debug;
}
if (params) {
for (var _local9 in params) {
_local2[_local9] = params[_local9];
}
}
if (files) {
for (var _local9 in files) {
_local2[_local9] = files[_local9];
}
}
if (open_browser) {
var _local6 = (GATEWAY_URL + "?seed=") + Math.random();
for (var _local9 in _local2) {
_local6 = _local6 + ((("&" + escape(_local9)) + "=") + escape(_local2[_local9]));
}
trace("OPENING " + _local6);
getURL (_local6, "_blank");
_local2.removeMovieClip();
} else {
var _local10 = new LoadVars();
_local10.remember_command_id = _local2.command_id;
_local10.onData = function (data) {
com.newgrounds.API.echo(("INPUT: \r" + data) + newline);
if (data) {
var _local2 = com.newgrounds.encoders.JSON.decode(data);
} else {
var _local2 = {success:false};
}
if (!_local2.success) {
if ((!_local2.error_code) && (!_local2.error_msg)) {
_local2.error_code = "CONNECTION_FAILED";
_local2.error_msg = "Could not contact the API Gateway";
_local2.command_id = this.remember_command_id;
}
var _local4 = new com.newgrounds.APIError(_local2.error_code, _local2.error_msg);
com.newgrounds.API.sendError(_local2, _local4);
} else {
com.newgrounds.API.doEvent(_local2);
}
};
var _local7 = new Array();
for (var _local8 in _local2) {
_local7.push((_local8 + "=") + escape(_local2[_local8]));
}
echo((("POST " + GATEWAY_URL) + "?") + _local7.join("&"));
_local2.sendAndLoad((GATEWAY_URL + "?seed=") + Math.random(), _local10, "POST");
last_command = _local2.command_id;
}
}
static function renderAd(target) {
if (ad_swf_url) {
target.background = target.createEmptyMovieClip("background", 100);
target.background.beginFill(0);
target.background.moveTo(0, 0);
target.background.lineTo(300, 0);
target.background.lineTo(300, 250);
target.background.lineTo(0, 250);
target.background.lineTo(0, 0);
target.background.endFill();
target.mask = target.createEmptyMovieClip("mask", 101);
target.mask.beginFill(0);
target.mask.moveTo(0, 0);
target.mask.lineTo(300, 0);
target.mask.lineTo(300, 250);
target.mask.lineTo(0, 250);
target.mask.lineTo(0, 0);
target.mask.endFill();
target.clip = target.createEmptyMovieClip("clip", 102);
target.clip.ad = target.clip.createEmptyMovieClip("ad", 100);
target.clip.setMask(target.mask);
target.clip.ad._lockroot = true;
loadMovie (ad_swf_url, target.clip.ad);
callListener(com.newgrounds.APIEvent.AD_ATTACHED, true, {target:target});
} else {
callListener(com.newgrounds.APIEvent.AD_ATTACHED, false, new com.newgrounds.APIError("FLASH_ADS_NOT_APPROVED", "Unable to render ad"));
}
}
static function attachFlashAd(target) {
if (checkAdFlood()) {
ad_swf_url = null;
} else if (checkAdCache()) {
reportNewAsset();
var _local1 = new LoadVars();
_local1.onData = function (data) {
if (data) {
com.newgrounds.API.ad_swf_url = data;
} else {
com.newgrounds.API.ad_swf_url = null;
}
com.newgrounds.API.reportAssetLoaded();
com.newgrounds.API.renderAd(target);
};
if (ad_url.indexOf("?") > -1) {
_local1.load((ad_url + "&random=") + Math.random());
} else {
_local1.load((ad_url + "?random=") + Math.random());
}
if (!ad_warning) {
ad_warning = true;
sendMessage("You may get a security sandbox violation from this ad. This is nothing to worry about!");
}
} else if (ad_swf_url) {
renderAd(target);
}
}
static function checkAdFlood() {
if (!ad_url) {
return(false);
}
var _local2 = new Date();
var _local1 = _local2.getTime();
if (_local1 >= ad_flood) {
if ((_local1 - ad_flood) > 1000) {
ad_flood = _local1 + 1000;
} else {
ad_flood = _local1;
sendWarning("This movie is attempting to load multiple ads at too high of a frequency; you may have a bad preloader loop.");
return(true);
}
}
return(false);
}
static function checkAdCache() {
if (!ad_url) {
return(false);
}
var _local2 = new Date();
var _local1 = _local2.getTime();
if (_local1 >= ad_url_cache) {
ad_url_cache = _local1 + 300000;
return(true);
}
return(false);
}
static function sendMessage(m, r) {
var _local1 = "[Newgrounds API] :: " + m;
if (r) {
return(_local1);
}
trace(_local1);
bridge.sendEvent("trace", {data:_local1});
}
static function echo(m) {
if (do_echo) {
trace(m);
}
}
static var LOGIN_URL = "http://ng-local.newgrounds.com/apilogin/";
static var do_echo = true;
static var GATEWAY_URL = "http://www.ngads.com/gateway_v2.php";
static var NEWGROUNDS_PREVIEW = "uploads.ungrounded.net/previews";
static var AD_TERMS_URL = "http://www.newgrounds.com/wiki/using-the-site/terms-of-use/flash-ads/";
static var COMMANDS_WIKI_URL = "http://www.newgrounds.com/wiki/developer-resources/flash-api/commands/";
static var LOCAL_HOST = "localhost";
static var NEWGROUNDS_WWW = "www.newgrounds.com";
static var PREVIEW_HOSTS = new Array(LOCAL_HOST, NEWGROUNDS_PREVIEW);
static var ad_url_cache = 0;
static var ad_flood = 0;
static var ad_warning = false;
static var save_file = null;
static var publisher_id = 1;
static var fake_session = false;
static var medals = null;
static var userpage_format = null;
static var scoreboards = new Array();
static var save_groups = null;
static var compression_radix = "/g8236klvBQ#&|;Zb*7CEA59%s`Oue1wziFp$rDVY@TKxUPWytSaGHJ>dmoMR^<0~4qNLhc(I+fjn)X";
static var errors = com.newgrounds.APIError.init_codes();
static var sharedObjects = new Object();
static var bridge = new com.newgrounds.Bridge(_root.NewgroundsAPI_SandboxID);
static var preload = true;
static var preload_items = 0;
static var preload_items_loaded = 0;
}
Symbol 152 MovieClip [__Packages.com.newgrounds.Bridge] Frame 0
class com.newgrounds.Bridge
{
var widget_id, receiver, transmitter;
function Bridge (id) {
widget_id = id;
receiver = new LocalConnection();
transmitter = new LocalConnection();
receiver.receiveEvent = function (event, params) {
com.newgrounds.API.callListener(event, params.success, params.data);
};
try {
receiver.connect("rec_" + widget_id);
} catch(error:Error) {
}
}
function sendEvent(event, params) {
if (widget_id) {
transmitter.send(widget_id, "sendEvent", event, validateParams(params));
}
}
function sendCommand(command, params) {
if (widget_id) {
transmitter.send(widget_id, "sendCommand", command, validateParams(params));
}
}
function validateParams(params) {
var _local2 = {};
for (var _local3 in params) {
if ((typeof(params[_local3]) == "string") || (typeof(params[_local3]) == "number")) {
_local2[_local3] = params[_local3];
}
}
return(_local2);
}
}
Symbol 153 MovieClip [__Packages.com.newgrounds.SaveFile] Frame 0
class com.newgrounds.SaveFile
{
static var file_path, image_path;
var _group, _filename, _file_id, _contents, _thumbnail, _thumbnail_url, raw, img, _file_url, _description, scanner;
function SaveFile (_group) {
this._group = _group;
_filename = null;
_file_id = null;
_contents = null;
_thumbnail = null;
_thumbnail_url = null;
raw = null;
img = null;
_draft = false;
_keys = new Array();
_ratings = new Array();
_file_url = null;
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.FILE_PRIVS_LOADED, checkPrivs, this);
}
static function setFilePath(path) {
file_path = path + "/";
}
static function setImagePath(path) {
image_path = path + "/";
}
function get name() {
return(_filename);
}
function set name(s) {
_filename = s;
//return(name);
}
function get id() {
return(_file_id);
}
function get description() {
return(_description);
}
function set description(s) {
_description = s;
//return(description);
}
function get contents() {
return(_contents);
}
function set contents(o) {
_contents = o;
//return(contents);
}
function get thumbnailUrl() {
return(image_path + _thumbnail_url);
}
function set thumbnailUrl(s) {
_thumbnail_url = s;
//return(thumbnailUrl);
}
function get fileUrl() {
return(file_path + _file_url);
}
function set fileUrl(s) {
_file_url = s;
//return(fileUrl);
}
function get authorID() {
return(_author_id);
}
function set authorID(i) {
_author_id = i;
//return(authorID);
}
function get authorName() {
return(_author_name);
}
function set authorName(n) {
_author_name = n;
//return(authorName);
}
function get views() {
return(_views);
}
function get draft() {
return(_draft);
}
function set draft(d) {
_draft = d;
//return(draft);
}
function get group() {
return(_group);
}
function get groupId() {
return(_group.getID());
}
function get groupName() {
return(_group.getName());
}
function get groupType() {
return(_group.getType());
}
function get locked() {
return(_locked);
}
function get shared() {
return(_isShared());
}
function get isPrivate() {
return(_isPrivate());
}
function get isPublic() {
return(_isPublic());
}
function get approved() {
return(_isApproved());
}
function get keys() {
return(_keys);
}
function get ratings() {
return(_ratings);
}
function loadAuthorPage() {
com.newgrounds.API.loadUserPage(_author_id, _author_name);
}
function getID() {
return(_file_id);
}
function exists() {
return(!(_file_id === null));
}
function getGroup() {
return(_group);
}
function getName() {
return(_filename);
}
function _isPrivate() {
return(status == STATUS.PRIVATE);
}
function _isShared() {
return(status > STATUS.PRIVATE);
}
function _isApproved() {
return(status > STATUS.UNAPPROVED);
}
function _isPublic() {
if (_isPrivate()) {
return(false);
}
if (_group.isType("SYSTEM") or _group.isType("PRIVATE")) {
return(false);
}
if (_group.isType("PUBLIC")) {
return(true);
}
if (_isApproved()) {
return(true);
}
return(false);
}
function isLocked() {
return(_locked);
}
function getDescription() {
return(_description);
}
function getShared() {
return(_draft);
}
function getThumbnailImageScan() {
return(img);
}
function getRawContents() {
return(raw);
}
function getDuplicateID() {
return(duplicate_id);
}
function getKeys() {
return(_keys);
}
function getKey(key) {
var _local3 = getGroup().getKey(key);
var _local2 = 0;
while (_local2 < _keys.length) {
if (_keys[_local2].id == _local3.key_id) {
return(_keys[_local2].value);
}
_local2++;
}
}
function getRating(rating) {
var _local2 = getGroup().getRating(rating);
if (_ratings[_local2.rating_id]) {
return(_ratings[_local2.rating_id]);
}
return(null);
}
function overwriteAllowed() {
return(overwrite);
}
function getFileURL() {
return(file_path + _file_url);
}
function getThumbnailURL() {
return(image_path + _thumbnail_url);
}
function overwriteExisting() {
overwrite = true;
}
function setID(id, add_to_group) {
_file_id = id;
if (add_to_group) {
getGroup().addFile(this);
}
}
function setName(filename, locked) {
_filename = filename;
_locked = locked;
}
function setDescription(description) {
_description = description;
}
function setDraft(draft) {
_draft = draft;
}
function setContents(_contents) {
this._contents = _contents;
}
function setThumbnail(thumb) {
if (thumb) {
_thumbnail = thumb;
} else {
_thumbnail = null;
}
}
function setThumbnailURL(url) {
_thumbnail_url = url;
}
function setFileURL(url) {
_file_url = url;
}
function setPermissions(status, _locked) {
this._locked = _locked;
this.status = status;
}
function setKey(key, val) {
var _local4 = getGroup().getKeyID(key);
var _local2;
if (!_local4) {
onError(((("'" + key) + "' is not a valid key for the '") + _group.__get__name()) + "' save group", "setKey", "INVALID_VALUE", true);
return(undefined);
}
if ((!_group.keyValueIsValid(key, val)) && (!(val === null))) {
onError((("'" + val) + "' is not a valid ") + _group.getKeyType(key, true), "setKey", "INVALID_VALUE", true);
return(undefined);
}
switch (_group.getKeyType(key, true)) {
case "string" :
if (val) {
val = String(val);
} else {
val = undefined;
}
break;
default :
val = Number(val);
}
var _local5 = {id:_local4, value:val};
for (var _local6 in _keys) {
_local2 = _keys[_local6];
if (_local2.id == _local4) {
_keys[_local6] = _local5;
return(undefined);
}
}
_keys.push(_local5);
}
function setRating(rating, votes, score) {
var _local2 = getGroup().getRating(rating);
if (!votes) {
votes = 0;
}
if (!score) {
score = 0;
}
if (!_local2.is_float) {
score = Math.round(Number(score));
}
_ratings[_local2.rating_id] = {id:Number(_local2.rating_id), name:_local2.rating_name, votes:Number(votes), score:Number(score)};
return(_ratings[_local2.rating_id]);
}
function clearBuffer() {
_contents = null;
raw = null;
img = null;
scanner = null;
overwrite = false;
duplicate_id = null;
}
function onError(msg, funct, code) {
busy = false;
if (!code) {
code = "SAVE_FILE_ERROR";
}
if (!funct) {
funct = "unknown_function";
}
var _local3 = ("getSaveGroup('" + _group.getName()) + "')";
if (exists()) {
funct = (((_local3 + ".getFile('") + getName()) + "').") + funct;
} else {
funct = (_local3 + ".getNewFile().") + funct;
}
var _local5 = new com.newgrounds.APIError(code, msg);
com.newgrounds.API.sendError({command_id:funct}, _local5);
}
function onSaved(p) {
busy = false;
if (!exists()) {
setID(p.save_id, true);
}
setName(p.filename);
setFileURL(p.file_url);
if (p.thumbnail) {
_thumbnail_url = p.thumbnail;
}
}
function onVoted(p) {
trace("ONVOTED WAS CALLED");
return(setRating(p.rating_id, p.votes, p.score));
}
function sendRating(rating, vote) {
var _local6 = null;
if (!com.newgrounds.API.hasUserSession()) {
_local6 = new com.newgrounds.APIError("PERMISSION_DENIED", "You must be logged in to vote on save files");
}
var _local2 = _group.getRating(rating);
if (!_local2) {
_local6 = new com.newgrounds.APIError("PERMISSION_DENIED", ((("'" + rating) + "' is not a valid rating for the '") + _group.getName()) + "' save group");
}
if (voted === true) {
_local6 = new com.newgrounds.APIError("PERMISSION_DENIED", "You have already voted on this item today");
}
if ((vote < _local2.min_value) or (vote > _local2.max_value)) {
_local6 = new com.newgrounds.APIError("PERMISSION_DENIED", (((("'" + rating) + "' votes must be between ") + _local2.min_value) + " and ") + _local2.max_value);
}
if (_local6) {
com.newgrounds.API.callListener(com.newgrounds.APIEvent.VOTE_COMPLETE, false, {error:_local6, file:this});
return(undefined);
}
voted = true;
com.newgrounds.API.rateSaveFile(this, _local2, vote);
}
function replace() {
if (busy) {
onError("Another file is currently being saved, please try again later", "replace");
return(undefined);
}
overwriteExisting();
save();
}
function save() {
if ((com.newgrounds.API.hasUserSession() && (!_author_id)) && (!_author_name)) {
_author_id = com.newgrounds.API.getUserID();
_author_name = com.newgrounds.API.getUserName();
}
if (busy) {
onError("Another file is currently being saved, please try again later", "save", "UPLOAD_IN_PROGRESS");
return(undefined);
}
busy = true;
if (isLocked()) {
onError("This file is _locked and cannot be overwritten.", "save", "PERMISSION_DENIED");
return(undefined);
}
if (!_filename) {
onError("Please provide a name for your file.", "save", "MISSING_PARAM");
return(undefined);
}
if (!_contents) {
onError("The file is empty.", "save", "MISSING_PARAM");
return(undefined);
}
img = null;
com.newgrounds.API.checkFilePrivs(this);
}
function checkPrivs(e) {
if (e.data.file.id != id) {
return(undefined);
}
if (e.success) {
if (e.data.can_write) {
can_write = e.data.can_write;
if (e.data.duplicate_id) {
duplicate_id = e.data.duplicate_id;
}
if (e.data.exists && (!overwriteAllowed())) {
onError(("You already have a file named '" + getName()) + "'", "save", "CONFIRM_REQUEST");
} else {
startFile();
}
} else {
onError("This file is _locked and cannot be overwritten", "save", "PERMISSION_DENIED");
}
} else {
onError("There was a problem looking up your file's details. The server may be down.", "save", "UNKNOWN_ERROR");
}
}
function startFile() {
if (can_write) {
if (_thumbnail) {
scanner = new com.newgrounds.encoders.ImageScanner(_thumbnail);
scanner.setCallback(this, "encodeFile");
scanner.startScan(100, 100, true);
} else {
encodeFile();
}
} else {
onError("You do not have permission to save this file.", "save", "PERMISSION_DENIED");
}
}
function encodeFile(img) {
this.img = img;
raw = com.newgrounds.encoders.SerialXML.encode(_contents).toString();
compressFile();
}
function compressFile() {
com.newgrounds.encoders.LZW2.compress(raw, function (s, p) {
p.file.onCompressed(s);
}, {file:this});
}
function onCompressed(compressed) {
raw = escape(compressed);
writeFile();
}
function getProgress() {
}
function writeFile() {
getGroup().getQuery().clearCache();
com.newgrounds.API.saveFile(this);
clearBuffer();
}
function loadContents() {
if (_contents) {
com.newgrounds.API.setCurrentSaveFile(this);
com.newgrounds.API.callListener(com.newgrounds.APIEvent.FILE_LOADED, true, {file:this});
return(undefined);
}
if (!getFileURL()) {
var _local4 = new com.newgrounds.APIError("FILE_NOT_FOUND", "Attempted to load contents of an unsaved file.");
com.newgrounds.API.callListener(com.newgrounds.APIEvent.FILE_LOADED, false, {file:this, error:_local4});
return(undefined);
}
var _local2 = new LoadVars();
_local2.target = this;
var target = this;
_local2.onData = function (encoded) {
target.onLoaded(encoded);
};
_local2.load(getFileURL());
}
function onLoaded(encoded) {
if (encoded == undefined) {
var _local3 = new com.newgrounds.APIError("FILE_NOT_FOUND", "We could not find the contents for this file. It may have been deleted.");
com.newgrounds.API.callListener(com.newgrounds.APIEvent.FILE_LOADED, false, {file:this, error:_local3});
return(undefined);
}
com.newgrounds.encoders.LZW.setXMLSafe(true);
_contents = com.newgrounds.encoders.SerialXML.decode(com.newgrounds.encoders.LZW.decompress(encoded));
com.newgrounds.API.callListener(com.newgrounds.APIEvent.FILE_LOADED, true, {file:this});
}
function setViews(n) {
_views = n;
}
static var busy = false;
var can_write = false;
var _draft = false;
var status = 0;
var voted = false;
var _views = 0;
var _locked = false;
var overwrite = false;
var duplicate_id = null;
var _keys = null;
var _ratings = null;
var _author_id = null;
var _author_name = null;
static var STATUS = {PRIVATE:1, PUBLIC:2, UNAPPROVED:3, APPROVED:4};
}
Symbol 154 MovieClip [__Packages.com.newgrounds.SaveGroup] Frame 0
class com.newgrounds.SaveGroup
{
var group_name, group_id, group_type, query, ratings, keys, files;
function SaveGroup (group_id, group_name, group_type) {
this.group_name = group_name;
this.group_id = group_id;
this.group_type = group_type;
query = new com.newgrounds.SaveGroupQuery(this);
ratings = new Array();
keys = new Array();
files = new Array();
}
function get id() {
return(group_id);
}
function get name() {
return(group_name);
}
function get type() {
return(group_type);
}
function addFile(file) {
var _local2 = 0;
while (_local2 < files.length) {
if (files[_local2].getID() == file.getID()) {
files[_local2] = file;
return(undefined);
}
_local2++;
}
files.push(file);
}
function getFile(file_id) {
trace("getting the file " + file_id);
var _local2 = 0;
while (_local2 < files.length) {
trace((((("Looking up " + file_id) + " :: ") + files[_local2].getID()) + " || ") + files[_local2].getName());
if (isNumeric(file_id) and (files[_local2].getID() == Number(file_id))) {
return(files[_local2]);
}
if (files[_local2].getName() == file_id) {
return(files[_local2]);
}
_local2++;
}
return(null);
}
function addRating(rating_id, rating_name, min_value, max_value, is_float) {
var _local3 = {rating_id:rating_id, rating_name:rating_name, min_value:min_value, max_value:max_value, is_float:is_float};
if (!getRatingID(rating_name)) {
ratings.push(_local3);
}
}
function getRating(rating_id) {
var _local2 = 0;
while (_local2 < ratings.length) {
if (isNumeric(rating_id) and (ratings[_local2].rating_id == rating_id)) {
return(ratings[_local2]);
}
if (ratings[_local2].rating_name == rating_id) {
return(ratings[_local2]);
}
_local2++;
}
return(null);
}
function getRatingID(rating_id) {
var _local2 = getRating(rating_id);
if (_local2) {
return(_local2.rating_id);
}
return(null);
}
function getRatingName(rating_id) {
var _local2 = getRating(rating_id);
if (_local2) {
return(_local2.rating_name);
}
return(null);
}
function addKey(key_id, key_name, key_type) {
trace(((((">>>>>>>>>>> ADDING KEY " + key_id) + " ") + key_name) + " ") + key_type);
var _local2 = {key_id:key_id, key_name:key_name, key_type:key_type};
if (!getKey(key_name)) {
keys.push(_local2);
}
}
function getKey(key_id) {
var _local2 = 0;
while (_local2 < keys.length) {
if (isNumeric(key_id) and (keys[_local2].key_id == key_id)) {
return(keys[_local2]);
}
if (keys[_local2].key_name == key_id) {
return(keys[_local2]);
}
_local2++;
}
return(null);
}
function getKeyType(key_name, as_string) {
var _local2 = getKey(key_name);
if (_local2) {
return((as_string ? (KEY_TYPES[_local2.key_type]) : (_local2.key_type)));
}
return(null);
}
function getKeyID(key_id) {
var _local2 = getKey(key_id);
if (_local2) {
return(_local2.key_id);
}
return(null);
}
function getKeyName(key_id) {
var _local2 = getKey(key_id);
if (_local2) {
return(_local2.key_name);
}
return(null);
}
function keyValueIsValid(key, value) {
var _local4;
var _local7;
if ((typeof(value) == "number") or (Number(value).toString() == String(value))) {
value = Number(value);
_local4 = ((Math.round(value) === value) ? "integer" : "float");
} else {
_local4 = typeof(value);
if (_local4 == "string") {
var _local6 = "01234567890.-";
var _local5 = true;
var _local2 = 0;
while (_local2 < value.length) {
if (_local6.indexOf(value.charAt(_local2)) < 0) {
_local5 = false;
break;
}
_local2++;
}
if (_local5) {
value = Number(value);
_local4 = "float";
}
}
}
switch (getKeyType(key, true)) {
case "integer" :
_local7 = (_local4 == "integer") or (_local4 == "boolean");
break;
case "float" :
_local7 = ((_local4 == "float") or (_local4 == "integer")) or (_local4 == "boolean");
break;
case "string" :
_local7 = (((_local4 == "string") or (_local4 == "float")) or (_local4 == "integer")) or (_local4 == "boolean");
break;
case "boolean" :
_local7 = (((_local4 == "boolean") or (value == 1)) or (value == 0)) or (value == "");
break;
default :
_local7 = false;
}
return(_local7);
}
function isType(type) {
return(group_type == TYPES[type.toUpperCase()]);
}
function getID() {
return(group_id);
}
function getName() {
return(group_name);
}
function getType() {
return(group_type);
}
function isSystem() {
return(undefined);
}
function getQuery(as_object) {
if (as_object) {
return(query.toObject());
}
return(query);
}
function newQuery() {
query.reset();
return(query);
}
function clearQuery() {
query.reset();
}
function newFile() {
var _local2 = new com.newgrounds.SaveFile(this);
return(_local2);
}
static function isNumeric(value) {
return((typeof(value) == "number") or (Number(value).toString() == String(value)));
}
static var KEY_TYPES = [null, "float", "integer", "string", "boolean"];
static var TYPES = {SYSTEM:0, PRIVATE:1, PUBLIC:2, MODERATED:3};
}
Symbol 155 MovieClip [__Packages.com.newgrounds.ValidationTools] Frame 0
class com.newgrounds.ValidationTools
{
function ValidationTools () {
}
static function isNumber(v) {
if (typeof(v) == "number") {
return(true);
}
if ((typeof(v) == "string") and (Number(v).toString() == v)) {
return(true);
}
return(false);
}
static function isInteger(v) {
if (isNumber(v)) {
v = Number(v);
return(Math.floor(v) == v);
}
return(false);
}
static function isFloat(v) {
return(isNumber(v));
}
static function isString(v) {
if ((typeof(v) == "string") or (typeof(v) == "number")) {
return(true);
}
return(false);
}
static function isEmpty(o) {
for (var _local2 in o) {
return(false);
}
return(true);
}
}
Symbol 156 MovieClip [__Packages.com.newgrounds.APIEvent] Frame 0
class com.newgrounds.APIEvent
{
var _type, _success, _error, data;
function APIEvent (type, success, data) {
_type = type;
_success = success;
if (data.isError()) {
_error = data;
this.data = null;
} else if (data.error && (data.error.isError())) {
_error = data.error;
this.data = data;
} else {
this.data = data;
_error = null;
}
}
function get error() {
return(_error);
}
function get type() {
return(_type);
}
function get success() {
return(_success);
}
static var API_CONNECTED = "apiConnected";
static var ADS_APPROVED = "adsApproved";
static var AD_ATTACHED = "adAttached";
static var HOST_BLOCKED = "hostBlocked";
static var NEW_VERSION_AVAILABLE = "newVersionAvailable";
static var EVENT_LOGGED = "eventLogged";
static var SCORE_POSTED = "scorePosted";
static var SCORES_LOADED = "scoresLoaded";
static var UNLOCK_MEDAL = "unlockMedal";
static var MEDAL_UNLOCKED = "medalUnlocked";
static var MEDALS_LOADED = "medalsLoaded";
static var METADATA_LOADED = "metadataLoaded";
static var FILE_PRIVS_LOADED = "filePrivsLoaded";
static var FILE_SAVED = "fileSaved";
static var FILE_LOADED = "fileLoaded";
static var FILE_INITIALIZED = "fileInitialized";
static var FILE_REQUESTED = "fileRequested";
static var QUERY_COMPLETE = "queryComplete";
static var VOTE_COMPLETE = "voteComplete";
static var API_ERROR = "apiError";
static var UNCAUGHT_EVENT = "uncaughtEvent";
}
Symbol 157 MovieClip [__Packages.com.newgrounds.SaveGroupQuery] Frame 0
class com.newgrounds.SaveGroupQuery
{
var _group, _num_results, _pages, _page, _randomize_results, file_conditions, key_conditions, rating_conditions, sort_conditions, lookup_keys, lookup_ratings, _group_by;
function SaveGroupQuery (_group) {
this._group = _group;
reset();
}
function get group() {
return(_group);
}
function get groupId() {
return(_group.getID());
}
function get resultsPerPage() {
return(_num_results);
}
function set resultsPerPage(n) {
_num_results = n;
//return(resultsPerPage);
}
function get pages() {
return(_pages);
}
function get page() {
return(_page);
}
function set page(n) {
_page = n;
//return(page);
}
function get randomize() {
return(_randomize_results);
}
function set randomize(b) {
_randomize_results = b;
//return(randomize);
}
function get results() {
return(_results);
}
function clearCache() {
_results = [];
}
function reset() {
file_conditions = new Array();
key_conditions = new Array();
rating_conditions = new Array();
sort_conditions = new Array();
lookup_keys = new Object();
lookup_ratings = new Object();
_num_results = 20;
_page = 1;
_randomize_results = false;
_group_by = new Array();
clearCache();
}
function getGroup() {
return(_group);
}
function getGroupID() {
return(_group.getID());
}
function isRandomized() {
return(_randomize_results);
}
function toObject() {
var _local2;
var _local11 = {page:_page, num_results:_num_results};
if (_randomize_results) {
_local11.randomize = 1;
}
if (!com.newgrounds.ValidationTools.isEmpty(file_conditions)) {
var _local12 = [];
_local2 = 0;
while (_local2 < file_conditions.length) {
var _local6 = file_conditions[_local2];
_local12.push({field:file_fields[_local6.field.toUpperCase()].id, operator:_local6.operator, value:_local6.value});
_local2++;
}
_local11.file_conditions = _local12;
}
if (!com.newgrounds.ValidationTools.isEmpty(key_conditions)) {
_local11.key_conditions = key_conditions;
}
if (!com.newgrounds.ValidationTools.isEmpty(rating_conditions)) {
_local11.rating_conditions = rating_conditions;
}
if (!com.newgrounds.ValidationTools.isEmpty(sort_conditions)) {
var _local14 = [];
_local2 = 0;
while (_local2 < sort_conditions.length) {
var _local3 = sort_conditions[_local2];
if (_local3.table == TABLE_FILES) {
var _local8 = file_fields[_local3.field.toUpperCase()].id;
} else {
var _local8 = _local3.field;
}
var _local5 = {field:_local8, table:_local3.table};
if (_local3.desc) {
_local5.desc = 1;
}
if (_local3.extra) {
_local5.extra = _local3.extra;
}
_local14.push(_local5);
_local2++;
}
_local11.sort_conditions = _local14;
}
if (!com.newgrounds.ValidationTools.isEmpty(lookup_keys)) {
var _local15 = [];
for (_local2 in lookup_keys) {
_local15.push(_local2);
}
_local11.lookup_keys = _local15;
}
if (!com.newgrounds.ValidationTools.isEmpty(lookup_ratings)) {
var _local13 = [];
for (_local2 in lookup_ratings) {
_local13.push(_local2);
}
_local11.lookup_ratings = _local13;
}
if (!com.newgrounds.ValidationTools.isEmpty(_group_by)) {
var _local16 = [];
_local2 = 0;
while (_local2 < _group_by.length) {
var _local4 = _group_by[_local2];
if (_local4.table == TABLE_FILES) {
var _local8 = file_fields[_local4.field.toUpperCase()].id;
} else {
var _local8 = _local4.field;
}
_local16.push({field:_local8, table:_local4.table});
_local2++;
}
_local11.group_by = _local16;
}
return(_local11);
}
function toString() {
var _local9;
var _local2;
var _local11 = [];
_local9 = "Lookup:\r";
var _local14 = [];
for (var _local6 in file_fields) {
_local14.push(" " + _local6);
_local2 = true;
}
_local9 = _local9 + _local14.join(newline);
_local11.push(_local9);
_local9 = "";
_local2 = false;
var _local16 = [];
for (var _local6 in lookup_keys) {
_local16.push((" KEY '" + _group.getKeyName(_local6)) + "'");
_local2 = true;
}
if (_local2) {
_local9 = _local9 + _local16.join(newline);
_local11.push(_local9);
}
_local9 = "";
_local2 = false;
var _local15 = [];
for (var _local6 in lookup_ratings) {
_local15.push((" RATING '" + _group.getRatingName(_local6)) + "'");
_local2 = true;
}
if (_local2) {
_local9 = _local9 + _local15.join(newline);
_local11.push(_local9);
}
_local9 = "Where:\r";
_local2 = false;
var _local8 = [];
var _local6 = 0;
while (_local6 < file_conditions.length) {
var _local7 = file_conditions[_local6];
var _local10 = ((((" " + _local7.field) + " ") + _local7.operator) + " ") + _local7.value;
_local8.push(_local10);
_local2 = true;
_local6++;
}
_local6 = 0;
while (_local6 < key_conditions.length) {
var _local7 = key_conditions[_local6];
var _local10 = ((((" KEY '" + _group.getKeyName(_local7.key_id)) + "' ") + _local7.operator) + " ") + _local7.value;
_local8.push(_local10);
_local2 = true;
_local6++;
}
_local6 = 0;
while (_local6 < rating_conditions.length) {
var _local7 = rating_conditions[_local6];
var _local10 = ((((" RATING '" + _group.getRatingName(_local7.rating_id)) + "' ") + _local7.operator) + " ") + _local7.value;
_local8.push(_local10);
_local2 = true;
_local6++;
}
if (_local2) {
_local9 = _local9 + _local8.join(newline);
_local11.push(_local9);
}
_local9 = "Group By:\r";
_local2 = false;
var _local13 = [];
_local6 = 0;
while (_local6 < _group_by.length) {
var _local4 = _group_by[_local6];
var _local5;
if (_local4.table == TABLE_KEYS) {
_local5 = (" KEY '" + _group.getKeyName(_local4.field)) + "'";
} else if (_local4.table == TABLE_RATINGS) {
_local5 = (" RATING '" + _group.getRatingName(_local4.field)) + "'";
} else {
_local5 = " " + _local4.field;
}
_local13.push(_local5);
_local2 = true;
_local6++;
}
if (_local2) {
_local9 = _local9 + _local13.join(newline);
_local11.push(_local9);
}
_local9 = "Order By:\r";
_local2 = false;
var _local12 = [];
if (isRandomized()) {
_local12.push(" RANDOM");
_local2 = true;
}
_local6 = 0;
while (_local6 < sort_conditions.length) {
var _local3 = sort_conditions[_local6];
if (_local3.table == TABLE_KEYS) {
var _local5 = (" KEY '" + _group.getKeyName(_local3.field)) + "'";
} else if (_local3.table == TABLE_RATINGS) {
var _local5 = ((" RATING '" + _group.getRatingName(_local3.field)) + "' ") + ((_local3.extra == "votes") ? "VOTES" : "SCORE");
} else {
var _local5 = " " + _local3.field;
}
var _local5 = _local5 + (_local3.desc ? " (DESCENDING)" : "");
_local12.push(_local5);
_local2 = true;
_local6++;
}
if (_local2) {
_local9 = _local9 + _local12.join(newline);
_local11.push(_local9);
}
_local11.push("Page:\r " + _page);
_local11.push("Results Per Page:\r " + _num_results);
return(_local11.join(newline));
}
function setResultsPerPage(r) {
_num_results = r;
clearCache();
}
function setPage(p) {
_page = p;
clearCache();
}
function setRandomize(bool) {
_randomize_results = ((bool === false) ? false : true);
}
function includeKey(key) {
if (!_group.getKeyID(key)) {
trace(((("[SaveGroupQuery Error] :: '" + key) + "' is not a valid key for the '") + _group.__get__name()) + "' group.");
return(undefined);
}
lookup_keys[_group.getKeyID(key)] = 1;
clearCache();
}
function includeRating(rating) {
if (!_group.getRatingID(rating)) {
trace(((("[SaveGroupQuery Error] :: '" + rating) + "' is not a valid rating for the '") + _group.__get__name()) + "' group.");
return(undefined);
}
lookup_ratings[_group.getRatingID(rating)] = 1;
clearCache();
}
function groupBy(field) {
addGroupItem(TABLE_FILES, field);
}
function groupByKey(key) {
if (!_group.getKeyID(key)) {
error(((("'" + key) + "' is not a valid key for the '") + _group.getName()) + "' _group");
return(undefined);
}
addGroupItem(TABLE_KEYS, _group.getKeyID(key));
}
function groupByRating(rating) {
if (!_group.getRatingID(rating)) {
error(((("'" + rating) + "' is not a valid rating for the '") + _group.getName()) + "' _group");
return(undefined);
}
addGroupItem(TABLE_RATINGS, _group.getRatingID(rating));
}
function addGroupItem(table, field) {
_group_by.push({table:table, field:field});
clearCache();
}
function excludeKey(key) {
delete lookup_keys[_group.getKeyID(key)];
clearCache();
}
function excludeRating(rating) {
delete lookup_ratings[_group.getRatingID(rating)];
clearCache();
}
function addCondition(field, operator, value) {
if (((field == "FILE_STATUS") && (typeof(value) == "string")) && (!(com.newgrounds.SaveFile.STATUS[value.toUpperCase()] === undefined))) {
value = com.newgrounds.SaveFile.STATUS[value.toUpperCase()];
}
if (operator == "==") {
operator = "=";
}
if ((!validateOperator(operator)) or (!validateValue(field, value))) {
return(undefined);
}
file_conditions.push({field:field, operator:operator, value:value});
clearCache();
}
function addKeyCondition(key, operator, value) {
if (!_group.getKeyID(key)) {
error(((("'" + key) + "' is not a valid key for the '") + _group.getName()) + "' save _group");
} else if ((!validateOperator(operator)) or (!validateKeyValue(key, value))) {
return(undefined);
}
key_conditions.push({key_id:_group.getKeyID(key), operator:operator, value:value});
clearCache();
}
function addRatingCondition(rating, operator, value, column) {
if (!column) {
column = "SCORE";
}
if (!_group.getRatingID(rating)) {
error(((("'" + rating) + "' is not a valid rating for the '") + _group.getName()) + "' save _group");
} else {
if (!validateOperator(operator)) {
return(undefined);
}
if (!com.newgrounds.ValidationTools.isNumber(value)) {
error(("Expected numeric value for rating '" + rating) + "'");
return(undefined);
}
}
if (!rating_columns[column]) {
var _local2 = [];
for (var _local3 in rating_columns) {
_local2.push(_local3);
}
error((("Invalid rating column '" + column) + "'. Valid columns are ") + _local2.join(", "));
return(undefined);
}
rating_conditions.push({rating_id:_group.getRatingID(rating), operator:operator, value:value, column:rating_columns[column]});
clearCache();
}
function sortOn(field, order) {
if (!file_fields[field]) {
var _local2 = [];
for (var _local3 in file_fields) {
_local2.push(_local3);
}
error((("'" + field) + "' is not a valid sort field. Valid fields are: ") + _local2.join(", "));
return(undefined);
}
addSortCondition(TABLE_FILES, field, order);
}
function sortOnKey(key, order) {
if (!_group.getKeyID(key)) {
error(((("'" + key) + "' is not a valid key for the '") + _group.getName()) + "' _group");
return(undefined);
}
addSortCondition(TABLE_KEYS, _group.getKeyID(key), order);
}
function sortOnRating(rating, order, column) {
if (!_group.getRatingID(rating)) {
error(((("'" + rating) + "' is not a valid rating for the '") + _group.getName()) + "' _group");
return(undefined);
}
if (!column) {
column = "score";
}
addSortCondition(TABLE_RATINGS, _group.getRatingID(rating), order, column);
}
function sortOnRatingScore(rating, order) {
sortOnRating(rating, order, "score");
}
function sortOnRatingVotes(rating, order) {
sortOnRating(rating, order, "votes");
}
function addSortCondition(table, field, order, extra) {
var _local7;
if (((!order) or (order == "")) or (order.toUpperCase() == "ASC")) {
_local7 = false;
} else if (order.toUpperCase() == "DESC") {
_local7 = true;
} else {
error(("'" + order) + "' is not a valid sort order!");
return(undefined);
}
var _local3 = {table:table, field:field, desc:_local7};
if (extra) {
_local3.extra = extra;
}
sort_conditions.push(_local3);
clearCache();
}
function onExecuted(results) {
_results = [];
var _local6 = 0;
while (_local6 < results.length) {
var _local2 = results[_local6];
var _local3 = new com.newgrounds.SaveFile(_group);
_local3.setName(_local2.filename);
_local3.setID(_local2.save_id);
_local3.setDescription(_local2.description);
_local3.setThumbnailURL(_local2.thumb);
_local3.setFileURL(_local2.file);
if (_local2.views) {
_local3.setViews(_local2.views);
}
_local3.setPermissions(_local2.status, _local2.locked);
_local3.authorName = _local2.user_name;
_local3.authorID = _local2.user_id;
var _local5 = 0;
while (_local5 < _local2.keys.length) {
_local3.setKey(_local2.keys[_local5].id, _local2.keys[_local5].value);
_local5++;
}
var _local4 = 0;
while (_local4 < _local2.ratings.length) {
_local3.setRating(_local2.ratings[_local4].id, _local2.ratings[_local4].votes, _local2.ratings[_local4].score);
_local4++;
}
getGroup().addFile(_local3);
_results.push(_local3);
_local6++;
}
callEventDispatcher();
}
function hasResults() {
return(_results && (_results.length > 0));
}
function callEventDispatcher() {
com.newgrounds.API.callListener(com.newgrounds.APIEvent.QUERY_COMPLETE, true, {query:this});
}
function execute() {
if (hasResults() && (!isRandomized())) {
callEventDispatcher();
return(undefined);
}
_group.query = this;
com.newgrounds.API.lookupSaveFiles(_group);
}
function processResults(files) {
return(null);
}
function validateKeyValue(key, value) {
var _local3 = _group.getKeyType(key);
if (_local3) {
var _local2 = com.newgrounds.SaveGroup.KEY_TYPES[_local3];
if ((_local2 == "float") and com.newgrounds.ValidationTools.isFloat(value)) {
return(true);
}
if ((_local2 == "integer") and com.newgrounds.ValidationTools.isInteger(value)) {
return(true);
}
if ((_local2 == "string") and com.newgrounds.ValidationTools.isString(value)) {
return(true);
}
error(((("Expected type " + _local2) + " for key '") + key) + "'");
}
return(false);
}
function validateValue(field, value) {
if (file_fields[field]) {
if ((file_fields[field].type == "integer") and com.newgrounds.ValidationTools.isInteger(value)) {
return(true);
}
if ((file_fields[field].type == "float") and com.newgrounds.ValidationTools.isFloat(value)) {
return(true);
}
if ((file_fields[field].type == "string") and com.newgrounds.ValidationTools.isString(value)) {
return(true);
}
error(((("Expecting " + file_fields[field].type) + " value on '") + field) + "' condition");
} else {
var _local2 = [];
for (var _local4 in file_fields) {
_local2.push(_local4);
}
error((("'" + field) + "' is not a searchable field. Valid fields are: ") + _local2.join(", "));
}
return(false);
}
function validateOperator(operator) {
var _local2 = 0;
while (_local2 < valid_operators.length) {
if (operator == valid_operators[_local2]) {
return(true);
}
_local2++;
}
error((("'" + operator) + "' is not a valid lookup operation. Valid operations are: ") + valid_operators.join(", "));
return(false);
}
function error(msg) {
trace("[QUERY ERROR] :: " + msg);
}
static var TABLE_FILES = 1;
static var TABLE_KEYS = 2;
static var TABLE_RATINGS = 3;
var _results = [];
static var file_fields = {FILE_ID:{id:0, field:"file_id", type:"integer"}, AUTHOR_ID:{id:1, field:"user_id", type:"integer"}, AUTHOR_NAME:{id:2, field:"user_name", type:"string"}, FILE_NAME:{id:3, field:"file_name", type:"string"}, CREATED_ON:{id:4, field:"created", type:"string"}, UPDATED_ON:{id:5, field:"last_update", type:"string"}, TOTAL_VIEWS:{id:6, field:"views", type:"integer"}, FILE_STATUS:{id:7, field:"status", type:"integer"}};
static var rating_columns = {TOTAL_VOTES:"votes", SCORE:"score"};
static var valid_operators = ["=", "<", ">", "!=", "<>", "<=", ">=", "*", "!*", "!*=", "!=*", "*=", "=*"];
}
Symbol 158 MovieClip [__Packages.com.newgrounds.encoders.BaseN] Frame 0
class com.newgrounds.encoders.BaseN
{
var ceiling, hashIndex, bitSize, hashVal, i;
function BaseN (hash) {
ceiling = 100000000000000;
if (hash) {
hashIndex = hash;
} else {
hashIndex = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~@#$%^&*()+|;/";
}
bitSize = hashIndex.length;
hashVal = new Object();
i = 0;
while (i < bitSize) {
hashVal[hashIndex.charAt(i)] = i;
i++;
}
}
function verify(s) {
if (hashVal[s] != undefined) {
return(true);
}
return(false);
}
function encode(n, minchars) {
debug.lastencode = "";
if (typeof(i) != "string") {
n = n.toString();
}
if (n.charAt(0) == "-") {
var _local3 = "-";
n = n.substring(1);
} else {
var _local3 = "";
}
if (String(n).indexOf(".") > -1) {
var _local4 = String(n).split(".", 2);
return(((_local3 + baseNEncoder(_local4[0], minchars)) + ".") + baseNEncoder(_local4[1]));
}
debug.lastencode = debug.lastencode + "\tNo decimal\r";
return(_local3 + baseNEncoder(n, minchars));
}
function decode(s) {
var _local4 = 1;
if (s.charAt(0) == "-") {
_local4 = -1;
s = s.substring(1, s.length);
}
var _local3 = s.indexOf(".");
if (_local3 > -1) {
var _local5 = Math.pow(10, baseNDecoder(s.substring(_local3 + 1, s.length)));
return((baseNDecoder(s.substring(0, _local3)) / _local5) * _local4);
}
return(baseNDecoder(s) * _local4);
}
function baseNEncoder(n, minchars) {
if (!minchars) {
minchars = 1;
}
var _local4 = "";
while (n != 0) {
n = Math.round(n);
var _local3 = n % bitSize;
if (Math.round(_local3) != _local3) {
trace((((((((("BaseN failed on " + n) + "%") + bitSize) + " = ") + _local3) + " ") + int(n)) + " ") + int(bitSize));
}
_local4 = hashIndex.charAt(_local3) + _local4;
debug.lastencode = debug.lastencode + (((((((("\t-> n:" + n) + " % bitSize:") + bitSize) + " = ") + _local3) + ", final char=") + _local4) + newline);
n = n - _local3;
n = n / bitSize;
}
if (minchars) {
while (_local4.length < minchars) {
_local4 = hashIndex.charAt(0) + _local4;
}
}
return(_local4);
}
function baseNDecoder(s) {
var _local2 = 0;
var _local6 = 0;
i = 0;
while (i < s.length) {
var _local3 = s.charAt((s.length - i) - 1);
if (_local3 == hashIndex.charAt(0)) {
var _local5 = 0;
} else {
var _local5 = hashVal[_local3] * Math.pow(bitSize, i);
}
_local2 = _local2 + _local5;
if (_local2 >= ceiling) {
_local6 = _local6 + ((_local2 - (_local2 % ceiling)) / ceiling);
_local2 = _local2 % ceiling;
}
i++;
}
if (_local6 > 0) {
_local2 = "" + _local2;
while (_local2.length < (ceiling.toString().length - 1)) {
_local2 = "0" + _local2;
}
_local2 = ("" + _local6) + _local2;
}
return(_local2);
}
var debug = new Object();
}
Symbol 159 MovieClip [__Packages.com.newgrounds.encoders.ImageScanner] Frame 0
class com.newgrounds.encoders.ImageScanner
{
var image_source, source_width, source_height, sourceBitmap, callback_target, callback_function, hash, cube, basen, xpos, ypos, pixels, busy, canvas_width, canvas_height, resizedBitmap, copyBitmap, output, draw_interval, callback_interval;
function ImageScanner (the_source) {
if (the_source) {
image_source = the_source;
} else {
image_source = _root;
}
reset();
if (typeof(image_source) == "movieclip") {
if (image_source == _root) {
source_width = Stage.width;
source_height = Stage.height;
} else {
source_width = Math.floor(image_source._width);
source_height = Math.floor(image_source._height);
}
sourceBitmap = new flash.display.BitmapData(source_width, source_height, false, 4294967295);
sourceBitmap.draw(_root);
} else if (image_source.width) {
source_width = image_source.width;
source_height = image_source.height;
sourceBitmap = image_source;
} else {
error("You can only use BitMaptData and MovieClip objects to create images");
}
}
function setCallback(target, funct) {
if (target && (funct)) {
callback_target = target;
callback_function = funct;
}
}
function reset() {
callback_target = null;
callback_function = null;
debug.bad_pixels = 0;
hash = "0123456789aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ<>?:;-_=+()!&";
var _local3 = Math.pow(hash.length, 2);
trace("MAX COLORS: " + _local3);
var _local2 = Math.floor(Math.pow(_local3, 0.333333333333333)) - 1;
var _local4 = Math.pow(_local2, 3);
cube = _local2;
basen = new com.newgrounds.encoders.BaseN(hash);
xpos = 0;
ypos = 0;
pixels = 0;
busy = false;
}
function startScan(w, h, s) {
if (w) {
image_width = w;
}
if (h) {
image_height = h;
}
if (s != undefined) {
crop = s;
}
var _local7 = _root.getNextHighestDepth();
var _local6 = _root.createEmptyMovieClip("API_image_container_" + _local7, _local7);
var _local5 = _local6.createEmptyMovieClip("canvas", 100);
_local5.attachBitmap(sourceBitmap, 100);
if (crop) {
if ((image_width / source_width) > (image_height / source_height)) {
canvas_width = image_width;
canvas_height = Math.ceil(source_height * (image_width / source_width));
} else {
canvas_height = image_height;
canvas_width = Math.ceil(source_width * (image_height / source_height));
}
} else {
canvas_width = image_width;
canvas_height = image_height;
}
_local5._x = Math.round((image_width - canvas_width) / 2);
_local5._width = canvas_width;
_local5._height = canvas_height;
resizedBitmap = new flash.display.BitmapData(image_width, image_height, false, 4294967295);
resizedBitmap.draw(_local6);
_local6.removeMovieClip();
copyBitmap = new flash.display.BitmapData(image_width, image_height, false, 4294967295);
var _local3 = "" + image_width;
while (_local3.length < 3) {
_local3 = "0" + _local3;
}
var _local4 = "" + image_height;
while (_local4.length < 3) {
_local4 = "0" + _local4;
}
output = _local3 + _local4;
draw_interval = setInterval(this, "drawChunk", 10);
busy = false;
return(resizedBitmap);
}
function getBitmapData() {
return(copyBitmap);
}
function getBytesTotal() {
return((image_width * image_height) * 2);
}
function getBytesScanned() {
return(pixels * 2);
}
function getProgress() {
return(Math.round((getBytesScanned() / getBytesTotal()) * 100));
}
function drawChunk() {
if (!busy) {
busy = true;
var _local2 = 0;
while (_local2 < pixels_per_chunk) {
if (!nextPixel()) {
clearInterval(draw_interval);
callback_interval = setInterval(this, "doCallback", 25);
busy = true;
break;
}
_local2++;
}
busy = false;
}
}
function doCallback() {
busy = false;
clearInterval(callback_interval);
if (callback_target and callback_function) {
callback_target[callback_function](output);
} else {
onScanComplete(output);
}
}
function onScanComplete(packet) {
sendMessage(("packet size: " + output.length) + " bytes", "onScanComplete");
}
function nextPixel() {
var _local15 = xpos;
var _local14 = ypos;
var _local7 = resizedBitmap.getPixel(_local15, _local14);
var _local17 = (_local7 >> 16) & 255;
var _local20 = (_local7 >> 8) & 255;
var _local16 = (_local7 >> 0) & 255;
var _local11 = Math.round(((_local17 + 1) / 256) * cube);
var _local10 = Math.round(((_local20 + 1) / 256) * cube);
var _local13 = Math.round(((_local16 + 1) / 256) * cube);
var _local12 = (((_local11 * (cube + 1)) * (cube + 1)) + (_local10 * (cube + 1))) + _local13;
var _local6 = basen.encode(_local12, 2);
output = output + _local6;
if (_local6.length != 2) {
trace("bad pixel " + _local6);
}
var _local5 = basen.decode(_local6);
var _local18 = _local5;
var _local8 = _local5 % (cube + 1);
_local5 = (_local5 - _local8) / (cube + 1);
var _local9 = _local5 % (cube + 1);
var _local19 = (_local5 - _local9) / (cube + 1);
if (((_local13 != _local8) and (_local10 != _local9)) and (_local11 != _local10)) {
debug.bad_pixels++;
trace((((((("BAD PIXEL " + debug.bad_pixels) + ") ") + _local12) + " != ") + _local18) + " ") + _local6);
trace(basen.debug.lastencode);
}
var _local2 = Math.round((_local19 / cube) * 255).toString(16);
var _local4 = Math.round((_local9 / cube) * 255).toString(16);
var _local3 = Math.round((_local8 / cube) * 255).toString(16);
while (_local2.length < 2) {
_local2 = "0" + _local2;
}
while (_local4.length < 2) {
_local4 = "0" + _local4;
}
while (_local3.length < 2) {
_local3 = "0" + _local3;
}
copyBitmap.setPixel(_local15, _local14, Number((("0x" + _local2) + _local4) + _local3));
pixels++;
if (pixels >= (image_width * image_height)) {
return(false);
}
xpos++;
if (xpos >= image_width) {
xpos = 0;
ypos++;
}
return(true);
}
function error(e, f) {
sendMessage(e, f, "ERROR");
}
function sendMessage(msg, func, type) {
var _local1 = "ImageScanner";
if (func) {
_local1 = _local1 + (("." + func) + "()");
}
if (type) {
_local1 = (type + " in ") + _local1;
}
_local1 = _local1 + (" :: " + msg);
trace(_local1);
}
var image_width = 100;
var image_height = 100;
var crop = true;
var pixels_per_chunk = 500;
var debug = new Object();
}
Symbol 160 MovieClip [__Packages.com.newgrounds.encoders.SerialXML] Frame 0
class com.newgrounds.encoders.SerialXML
{
function SerialXML () {
}
static function decode(xml) {
if (!(xml instanceof XML)) {
xml = new XML(xml);
}
var _local2 = populateObject(xml.firstChild, {});
return(_local2.DATA);
}
static function encode(obj) {
var _local1 = new XML();
populateXML(_local1, obj, "DATA");
return(_local1);
}
static function populateObject(child, object) {
var _local6 = child.nodeName;
var _local5 = getValue(_local6, child.attributes.v);
var _local4 = child.attributes.n;
if (object instanceof Array) {
_local4 = object.length;
object.push(_local5);
} else {
object[_local4] = _local5;
}
if (child.hasChildNodes()) {
var _local1 = 0;
while (_local1 < child.childNodes.length) {
populateObject(child.childNodes[_local1], object[_local4]);
_local1++;
}
}
return(object);
}
static function populateXML(child, obj, name) {
if (obj === undefined) {
return(undefined);
}
var _local5 = new XML();
var _local2;
if (obj instanceof Array) {
_local2 = _local5.createElement(getType(obj));
if (name) {
_local2.attributes.n = name;
}
child.appendChild(_local2);
var _local4 = 0;
while (_local4 < obj.length) {
populateXML(_local2, obj[_local4]);
_local4++;
}
} else if (typeof(obj) == "object") {
_local2 = _local5.createElement(getType(obj));
if (name) {
_local2.attributes.n = name;
}
child.appendChild(_local2);
for (var _local4 in obj) {
populateXML(_local2, obj[_local4], _local4);
}
} else {
_local2 = _local5.createElement(getType(obj));
if (name) {
_local2.attributes.n = name;
}
if (getType(obj).length == 1) {
_local2.attributes.v = obj;
}
child.appendChild(_local2);
}
}
static function getValue(type, stringval) {
switch (type.toUpperCase()) {
case "O" :
return(new Object());
case "A" :
return(new Array());
case "N" :
return(Number(stringval));
case "S" :
return(String(stringval));
case "TRUE" :
return(true);
case "FALSE" :
return(false);
}
return(null);
}
static function getType(obj) {
switch (((obj instanceof Array) ? "array" : (typeof(obj)))) {
case "array" :
return("A");
case "object" :
return("O");
case "string" :
return("S");
case "number" :
return("N");
case "boolean" :
return(((obj === true) ? "TRUE" : "FALSE"));
}
return("NULL");
}
}
Symbol 161 MovieClip [__Packages.com.newgrounds.encoders.LZW2] Frame 0
class com.newgrounds.encoders.LZW2
{
static var comp_dict, pos, result, buffer, nbChar, splitStr, len, local, interval;
function LZW2 () {
}
static function doCompressorConfig() {
comp_dict = [];
var _local1 = 0;
while (_local1 < 256) {
comp_dict[String.fromCharCode(_local1)] = _local1;
_local1++;
}
comp_dict["<"] = 256;
comp_dict[">"] = 257;
comp_dict["&"] = 258;
comp_dict["\""] = 259;
comp_dict["'"] = 260;
pos = 0;
result = "";
buffer = "";
nbChar = 256 + skipnum;
}
static function compress(string, callback, callback_params) {
doCompressorConfig();
if (busy) {
trace("[LZW COMPRESSOR] :: Compression can not begin until previous compression or decompression is complete!");
return(undefined);
}
splitStr = string.split("");
string = "";
len = splitStr.length;
local = {delay:30, callback:callback, callback_params:callback_params, compress_chunk:function () {
com.newgrounds.encoders.LZW2.compress_chunk();
}, busy:false, complete:false};
interval = setInterval(local, "compress_chunk", 5);
}
static function getProgress() {
return(Math.round((pos / len) * 100));
}
static function compress_chunk() {
if (local.delay > 0) {
local.delay--;
} else if (!local.busy) {
local.busy = true;
var _local1 = 0;
while (_local1 < max_chunk_length) {
encode_next();
if (local.complete) {
break;
}
_local1++;
}
local.busy = false;
}
if (local.complete) {
trace((((((((("LZW2 complete " + nbChar) + " ") + comp_dict.length) + " ") + len) + " ") + pos) + " ") + skipnum);
clearInterval(interval);
local.callback(result, local.callback_params);
result = "";
buffer = "";
}
}
static function encode_next() {
if (pos <= len) {
var _local1 = splitStr[pos];
if (!(comp_dict[buffer + _local1] === undefined)) {
buffer = buffer + _local1;
} else {
result = result + String.fromCharCode(comp_dict[buffer]);
comp_dict[buffer + _local1] = nbChar;
nbChar++;
buffer = _local1;
}
pos++;
} else {
local.complete = true;
return(undefined);
}
}
static var comp_config = false;
static var skipnum = 5;
static var busy = false;
static var max_chunk_length = 12000;
}
Symbol 162 MovieClip [__Packages.com.newgrounds.encoders.LZW] Frame 0
class com.newgrounds.encoders.LZW
{
function LZW () {
}
static function setXMLSafe(x) {
xmlsafe = x;
}
static function compress(str, escape_chars) {
var _local2 = new Array();
var _local11 = (xmlsafe ? 5 : 0);
var _local5 = 0;
while (_local5 < 256) {
_local2[String.fromCharCode(_local5)] = _local5;
_local5++;
}
if (xmlsafe) {
_local2["<"] = 256;
_local2[">"] = 257;
_local2["&"] = 258;
_local2["\""] = 259;
_local2["'"] = 260;
}
var _local7 = "";
var _local8 = str.split("");
var _local9 = _local8.length;
var _local6 = 256 + _local11;
var _local1 = "";
var _local4;
_local5 = 0;
while (_local5 <= _local9) {
var _local3 = _local8[_local5];
if (!(_local2[_local1 + _local3] === undefined)) {
_local1 = _local1 + _local3;
} else {
_local4 = String.fromCharCode(_local2[_local1]);
if (escape_chars and (((_local2[_local1] < 33) or (_local2[_local1] > 126)) or (_local4 == "%"))) {
_local4 = escape(_local4);
}
_local7 = _local7 + _local4;
_local2[_local1 + _local3] = _local6;
_local6++;
_local1 = _local3;
}
_local5++;
}
return(_local7);
}
static function decompress(str) {
var _local4 = new Array();
var _local10 = (xmlsafe ? 5 : 0);
var _local6 = 0;
while (_local6 < 256) {
var _local9 = String.fromCharCode(_local6);
_local4[_local6] = _local9;
_local6++;
}
if (xmlsafe) {
_local4[256] = "<";
_local4[257] = ">";
_local4[258] = "&";
_local4[259] = "\"";
_local4[260] = "'";
}
var _local11 = str;
var _local13 = _local11.split("");
var _local12 = _local13.length;
var _local7 = 256 + _local10;
var _local1 = "";
var _local2 = "";
var _local8 = "";
_local6 = 0;
while (_local6 < _local12) {
var _local5 = _local11.charCodeAt(_local6);
var _local3 = _local4[_local5];
if (_local1 == "") {
_local1 = _local3;
_local8 = _local8 + _local3;
} else if (_local5 <= (255 + _local10)) {
_local8 = _local8 + _local3;
_local2 = _local1 + _local3;
_local4[_local7] = _local2;
_local7++;
_local1 = _local3;
} else {
_local2 = _local4[_local5];
if (_local2 == undefined) {
_local2 = _local1 + _local1.slice(0, 1);
}
_local8 = _local8 + _local2;
_local4[_local7] = _local1 + _local2.slice(0, 1);
_local7++;
_local1 = _local2;
}
_local6++;
}
return(_local8);
}
static function compress_fp6(str) {
var _local3 = new Array();
var _local10 = (xmlsafe ? 5 : 0);
var _local4 = 0;
while (_local4 < 256) {
_local3[String(_local4)] = _local4;
_local4++;
}
if (xmlsafe) {
var _local14 = String(new String("<").charCodeAt(0));
var _local11 = String(new String(">").charCodeAt(0));
var _local13 = String(new String("&").charCodeAt(0));
var _local15 = String(new String("\"").charCodeAt(0));
var _local12 = String(new String("'").charCodeAt(0));
_local3[_local14] = 256;
_local3[_local11] = 257;
_local3[_local13] = 258;
_local3[_local15] = 259;
_local3[_local12] = 260;
}
var _local7 = "";
var _local16 = str;
var _local8 = _local16.split("");
var _local9 = _local8.length;
var _local6 = 256 + _local10;
var _local1 = new Array();
_local4 = 0;
while (_local4 <= _local9) {
var _local2 = _local8[_local4];
if (_local1.length == 0) {
var _local5 = String(_local2.charCodeAt(0));
} else {
var _local5 = (_local1.join("-") + "-") + String(_local2.charCodeAt(0));
}
if (!(_local3[_local5] === undefined)) {
_local1.push(_local2.charCodeAt(0));
} else {
_local7 = _local7 + String.fromCharCode(_local3[_local1.join("-")]);
_local3[_local5] = _local6;
_local6++;
_local1 = new Array();
_local1.push(_local2.charCodeAt(0));
}
_local4++;
}
return(_local7);
}
static var xmlsafe = false;
}
Symbol 163 MovieClip [__Packages.com.newgrounds.RemoteAuth] Frame 0
class com.newgrounds.RemoteAuth
{
var auth_token, receiver;
function RemoteAuth (id) {
auth_token = id;
System.security.allowDomain("*");
receiver = new LocalConnection();
receiver.allowDomain = function () {
return(true);
};
receiver.onAuth = function (auth_result) {
trace("remote login is a success! " + auth_result);
com.newgrounds.API.onRemoteAuthentication(auth_result);
};
receiver.connect("_" + auth_token);
}
function get token() {
return(auth_token);
}
}
Symbol 164 MovieClip [__Packages.com.newgrounds.Medal] Frame 0
class com.newgrounds.Medal
{
var _medal_id, _medal_name, _medal_value, _medal_difficulty;
function Medal (id, name, value, difficulty, unlocked, _icon_url) {
if ((((id == undefined) || (name == undefined)) || (value == undefined)) || (difficulty == undefined)) {
com.newgrounds.API.fatalError("Medal instances require an id, name, value and difficulty");
}
_medal_id = id;
_medal_name = name;
_medal_value = value;
_medal_difficulty = difficulty;
if (unlocked) {
_medal_unlocked = true;
}
if (_icon_url) {
this._icon_url = _icon_url;
}
}
function get difficulty() {
return(difficulty_names[_medal_difficulty]);
}
function get difficultyId() {
return(_medal_difficulty);
}
function get icon_url() {
return(_icon_url);
}
function get id() {
return(_medal_id);
}
function get name() {
return(_medal_name);
}
function get unlocked() {
return(_medal_unlocked);
}
function get value() {
return(_medal_value);
}
function isUnlocked() {
return(_medal_unlocked);
}
function unlock() {
if (!isUnlocked()) {
com.newgrounds.API.unlockMedal(this);
}
}
function setUnlocked(u) {
_medal_unlocked = u;
}
function attachIcon(target, depth) {
if (!depth) {
depth = target.getNextHighestDepth();
}
var _local3 = target.createEmptyMovieClip("Asset_Medal_Icon_" + getID(), depth);
if (_icon_url) {
_local3.loadMovie(_icon_url);
} else {
var _local4 = flash.display.BitmapData.loadBitmap("Asset_default_medal_icon_" + getDifficulty(), depth);
_local3.attachBitmap(_local4, depth, true);
}
}
function getID() {
return(_medal_id);
}
function getName() {
return(_medal_name);
}
function getValue() {
return(_medal_value);
}
function getDifficulty(as_string) {
if (as_string) {
return(difficulty_names[_medal_difficulty]);
}
return(_medal_difficulty);
}
var _medal_unlocked = false;
var _icon_loaded = false;
var _icon_width = 50;
var _icon_height = 50;
var _icon_url = null;
static var difficulty_names = new Array(null, "Easy", "Moderate", "Challenging", "Difficult", "Brutal");
}
Symbol 165 MovieClip [__Packages.com.newgrounds.ScoreBoard] Frame 0
class com.newgrounds.ScoreBoard
{
var _name, _id, _scores;
function ScoreBoard (id, name, tag) {
_name = name;
_id = id;
if (!(tag === undefined)) {
_tag = tag;
}
}
function exists() {
return(Number(_id) > 0);
}
function get id() {
return(_id);
}
function get name() {
return(_name);
}
function get period() {
return(_period);
}
function get tag() {
return(_tag);
}
function get page() {
return(_page);
}
function get num_results() {
return(_num_results);
}
function get scores() {
return(_scores);
}
function postScore(value, tag) {
if (!(tag === undefined)) {
_tag = tag;
}
com.newgrounds.API.postScore(_name, value, _tag);
}
function loadScores(period, page, num_results, tag) {
if (period) {
_period = period;
}
if (page) {
_page = page;
}
if (num_results) {
_num_results = num_results;
}
_scores = [];
com.newgrounds.API.loadScores(_name, _period, tag);
}
function setScores(scores, period, page, num_results) {
if (period) {
_period = period;
}
if (page) {
_page = page;
}
if (num_results) {
_num_results = num_results;
}
_scores = [];
var _local2 = 0;
while (_local2 < scores.length) {
var _local4 = ((_num_results * (_page - 1)) + 1) + _local2;
_scores.push(new com.newgrounds.Score(this, _local4, scores[_local2].username, scores[_local2].value, scores[_local2].numeric_value));
_local2++;
}
}
var _period = "Today";
var _num_results = 10;
var _page = 1;
var _tag = "";
}
Symbol 166 MovieClip [__Packages.com.newgrounds.Score] Frame 0
class com.newgrounds.Score
{
var _board, _position, _username, _value, _numeric_value;
function Score (board, position, username, value, numeric_value) {
_board = board;
_position = position;
_username = username;
_value = value;
_numeric_value = numeric_value;
}
function get board() {
return(_board);
}
function get position() {
return(_position);
}
function get username() {
return(_username);
}
function get value() {
return(_value);
}
function get numeric_value() {
return(_numeric_value);
}
static function fromTime(time) {
var _local1 = time.split(":");
var _local2 = Math.round(Number(_local1.pop()) * 1000);
if (_local1.length > 0) {
_local2 = _local2 + (Number(_local1.pop()) * 60);
}
if (_local1.length > 0) {
_local2 = _local2 + (Number(_local1.pop()) * 3600);
}
return(_local2);
}
static function fromDistance(distance) {
var _local1 = distance.indexOf("'");
var _local5 = distance.indexOf("\"", _local1);
var _local3 = Number(distance.substr(0, _local1));
var _local4 = Number(distance.substring(_local1 + 1, _local5));
return(Math.round((_local3 * 12) + _local4));
}
}
Symbol 167 MovieClip [__Packages.com.newgrounds.encoders.RC4] Frame 0
class com.newgrounds.encoders.RC4
{
function RC4 () {
}
static function encrypt(src, key) {
var _local3 = strToChars(src);
var _local1 = strToChars(key);
var _local2 = calculate(_local3, _local1);
return(charsToHex(_local2));
}
static function encryptbin(src, key) {
var _local3 = strToChars(src);
var _local1 = strToChars(key);
var _local2 = calculate(_local3, _local1);
return(_local2);
}
static function decrypt(src, key) {
var _local3 = hexToChars(src);
var _local1 = strToChars(key);
var _local2 = calculate(_local3, _local1);
return(charsToStr(_local2));
}
static function initialize(pwd) {
var _local2 = 0;
var _local3;
var _local4 = pwd.length;
var _local1 = 0;
while (_local1 <= 255) {
mykey[_local1] = pwd[_local1 % _local4];
sbox[_local1] = _local1;
_local1++;
}
_local1 = 0;
while (_local1 <= 255) {
_local2 = ((_local2 + sbox[_local1]) + mykey[_local1]) % 256;
_local3 = sbox[_local1];
sbox[_local1] = sbox[_local2];
sbox[_local2] = _local3;
_local1++;
}
}
static function calculate(plaintxt, psw) {
initialize(psw);
var _local1 = 0;
var _local2 = 0;
var _local9 = new Array();
var _local7;
var _local5;
var _local6;
var _local3 = 0;
while (_local3 < plaintxt.length) {
_local1 = (_local1 + 1) % 256;
_local2 = (_local2 + sbox[_local1]) % 256;
_local5 = sbox[_local1];
sbox[_local1] = sbox[_local2];
sbox[_local2] = _local5;
var _local4 = (sbox[_local1] + sbox[_local2]) % 256;
_local7 = sbox[_local4];
_local6 = plaintxt[_local3] ^ _local7;
_local9.push(_local6);
_local3++;
}
return(_local9);
}
static function charsToHex(chars) {
var _local4 = new String("");
var _local3 = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
var _local1 = 0;
while (_local1 < chars.length) {
_local4 = _local4 + (_local3[chars[_local1] >> 4] + _local3[chars[_local1] & 15]);
_local1++;
}
return(_local4);
}
static function hexToChars(hex) {
var _local3 = new Array();
var _local1 = ((hex.substr(0, 2) == "0x") ? 2 : 0);
while (_local1 < hex.length) {
_local3.push(parseInt(hex.substr(_local1, 2), 16));
_local1 = _local1 + 2;
}
return(_local3);
}
static function charsToStr(chars) {
var _local3 = new String("");
var _local1 = 0;
while (_local1 < chars.length) {
_local3 = _local3 + String.fromCharCode(chars[_local1]);
_local1++;
}
return(_local3);
}
static function strToChars(str) {
var _local3 = new Array();
var _local1 = 0;
while (_local1 < str.length) {
_local3.push(str.charCodeAt(_local1));
_local1++;
}
return(_local3);
}
static var sbox = new Array(255);
static var mykey = new Array(255);
}
Symbol 168 MovieClip [__Packages.com.newgrounds.encoders.JSON] Frame 0
class com.newgrounds.encoders.JSON
{
static var start, cache, interval;
function JSON () {
}
static function encode(arg, noquotes) {
var _local3;
var _local2;
var _local6;
var _local1 = "";
var _local4;
if (arg.isSServerVar()) {
var _local8 = "sservervariable";
} else {
var _local8 = typeof(arg);
}
switch (_local8) {
case "sservervariable" :
return("?" + arg.getEncodedValue());
case "object" :
if (arg) {
if (arg instanceof Array) {
_local2 = 0;
while (_local2 < arg.length) {
_local4 = encode(arg[_local2]);
if (_local1) {
_local1 = _local1 + ",";
}
_local1 = _local1 + _local4;
_local2++;
}
return(("[" + _local1) + "]");
}
if (typeof(arg.toString) != "undefined") {
for (_local2 in arg) {
_local4 = arg[_local2];
if ((typeof(_local4) != "undefined") && (typeof(_local4) != "function")) {
_local4 = encode(_local4);
if (_local1) {
_local1 = _local1 + ",";
}
_local1 = _local1 + ((encode(_local2) + ":") + _local4);
}
}
return(("{" + _local1) + "}");
}
}
return("null");
case "number" :
return((isFinite(arg) ? (String(arg)) : "null"));
case "string" :
_local6 = arg.length;
if (noquotes) {
var _local7 = "";
} else {
var _local7 = "\"";
}
_local1 = _local7;
_local2 = 0;
while (_local2 < _local6) {
_local3 = arg.charAt(_local2);
if (_local3 >= " ") {
if ((_local3 == "\\") || (_local3 == "\"")) {
_local1 = _local1 + "\\";
}
_local1 = _local1 + _local3;
} else {
switch (_local3) {
case "\b" :
_local1 = _local1 + "\\b";
break;
case "\f" :
_local1 = _local1 + "\\f";
break;
case newline :
_local1 = _local1 + "\\n";
break;
case "\r" :
_local1 = _local1 + "\\r";
break;
case "\t" :
_local1 = _local1 + "\\t";
break;
default :
_local3 = _local3.charCodeAt();
_local1 = _local1 + (("\\u00" + Math.floor(_local3 / 16).toString(16)) + (_local3 % 16).toString(16));
}
}
_local2 = _local2 + 1;
}
return(_local1 + _local7);
case "boolean" :
return(String(arg));
}
return("null");
}
static function background_encode(arg, callback) {
if (busy) {
trace("[Newgrounds Encoder] :: Cannot encode a new file until the previous file is completed");
return(false);
}
if (!callback) {
trace("[Newgrounds Encoder] :: Missing a callback function, skipping encode");
return(false);
}
busy = true;
var _local2 = new Date();
start = _local2.getTime();
cache = {busy:false, complete:false, arg:arg, target:arg, parents:[], encoded:"", callback:callback, encode_chunk:function () {
com.newgrounds.encoders.JSON.encode_chunk();
}};
if (getType(arg) == "object") {
cache.encoded = "{";
} else if (getType(arg) == "array") {
cache.encoded = "[";
}
interval = setInterval(cache, "encode_chunk", 25);
return(true);
}
static function background_decode(arg, callback) {
if (busy) {
trace("[Newgrounds Encoder] :: Cannot decode a new file until the previous file is completed");
return(false);
}
if (!callback) {
trace("[Newgrounds Encoder] :: Missing a callback function, skipping decode");
return(false);
}
busy = true;
var _local1 = new Date();
start = _local1.getTime();
cache = {busy:false, callback:callback, complete:false, arg:arg, pos:0, parents:["root"], target:null, scratch:"", decode_chunk:function () {
com.newgrounds.encoders.JSON.decode_chunk();
}};
interval = setInterval(cache, "decode_chunk", 25);
return(true);
}
static function decode(text) {
var at = 0;
var ch = " ";
var _value;
var _error = function (m) {
throw {name:"JSONError", message:m, at:at - 1, text:text};
};
var _next = function () {
ch = text.charAt(at);
at = at + 1;
return(ch);
};
var _white = function () {
while (ch) {
if (ch <= " ") {
_next();
} else if (ch == "/") {
switch (_next()) {
case "/" :
while ((_next() && (ch != newline)) && (ch != "\r")) {
}
break;
case "*" :
_next();
for(;;){
if (ch) {
if (ch == "*") {
if (_next() == "/") {
_next();
// unexpected jump
}
} else {
_next();
}
} else {
_error("Unterminated comment");
}
};
break;
default :
_error("Syntax error");
}
} else {
return;
}
}
};
var _string = function () {
var _local4;
var _local1 = "";
var _local3;
var _local2;
var _local5 = false;
if (ch == "\"") {
while (_next()) {
if (ch == "\"") {
_next();
return(_local1);
}
if (ch == "\\") {
switch (_next()) {
case "b" :
_local1 = _local1 + "\b";
break;
case "f" :
_local1 = _local1 + "\f";
break;
case "n" :
_local1 = _local1 + newline;
break;
case "r" :
_local1 = _local1 + "\r";
break;
case "t" :
_local1 = _local1 + "\t";
break;
case "u" :
_local2 = 0;
_local4 = 0;
while (_local4 < 4) {
_local3 = parseInt(_next(), 16);
if (!isFinite(_local3)) {
_local5 = true;
break;
}
_local2 = (_local2 * 16) + _local3;
_local4 = _local4 + 1;
}
if (_local5) {
_local5 = false;
break;
}
_local1 = _local1 + String.fromCharCode(_local2);
break;
default :
_local1 = _local1 + ch;
}
} else {
_local1 = _local1 + ch;
}
}
}
_error("Bad string");
};
var _array = function () {
var _local1 = [];
if (ch == "[") {
_next();
_white();
if (ch == "]") {
_next();
return(_local1);
}
while (ch) {
_local1.push(_value());
_white();
if (ch == "]") {
_next();
return(_local1);
}
if (ch != ",") {
break;
}
_next();
_white();
}
}
_error("Bad array");
};
var _object = function () {
var _local2;
var _local1 = {};
if (ch == "{") {
_next();
_white();
if (ch == "}") {
_next();
return(_local1);
}
while (ch) {
_local2 = _string();
_white();
if (ch != ":") {
break;
}
_next();
_local1[_local2] = _value();
_white();
if (ch == "}") {
_next();
return(_local1);
}
if (ch != ",") {
break;
}
_next();
_white();
}
}
_error("Bad object");
};
var _number = function () {
var _local1 = "";
var _local2;
if (ch == "-") {
_local1 = "-";
_next();
}
while ((ch >= "0") && (ch <= "9")) {
_local1 = _local1 + ch;
_next();
}
if (ch == ".") {
_local1 = _local1 + ".";
while ((_next() && (ch >= "0")) && (ch <= "9")) {
_local1 = _local1 + ch;
}
}
_local2 = 1 * _local1;
if (!isFinite(_local2)) {
_error("Bad number");
} else {
return(_local2);
}
};
var _word = function () {
switch (ch) {
case "t" :
if (((_next() == "r") && (_next() == "u")) && (_next() == "e")) {
_next();
return(true);
}
break;
case "f" :
if ((((_next() == "a") && (_next() == "l")) && (_next() == "s")) && (_next() == "e")) {
_next();
return(false);
}
break;
case "n" :
if (!(((_next() == "u") && (_next() == "l")) && (_next() == "l"))) {
break;
}
_next();
return(null);
}
_error("Syntax error");
};
_value = function () {
_white();
switch (ch) {
case "{" :
return(_object());
case "[" :
return(_array());
case "\"" :
return(_string());
case "-" :
return(_number());
}
return((((ch >= "0") && (ch <= "9")) ? (_number()) : (_word())));
};
return(_value());
}
static function getType(v) {
if (v instanceof Array) {
return("array");
}
return(typeof(v));
}
static function decode_chunk() {
if ((!cache.busy) && (!cache.complete)) {
cache.busy = true;
var _local1 = 0;
while (_local1 < decode_chunks) {
chunk_decoder();
if (cache.complete) {
break;
}
_local1++;
}
trace(Math.round((cache.pos / cache.arg.length) * 100) + "% decoded");
cache.busy = false;
}
if (cache.complete) {
var _local2 = new Date();
busy = false;
clearInterval(interval);
cache.callback(cache.root, _local2.getTime() - start);
cache.arg = "";
}
}
static function encode_chunk() {
if ((!cache.busy) && (!cache.complete)) {
cache.busy = true;
var _local1 = 0;
while (_local1 < encode_chunks) {
chunk_encoder();
if (cache.complete) {
break;
}
_local1++;
}
cache.busy = false;
}
if (cache.complete) {
var _local3 = new Date();
var _local2 = _local3.getTime();
busy = false;
clearInterval(interval);
cache.callback(cache.encoded, _local2 - start);
cache.encoded = "";
}
}
static function chunk_decoder() {
function _object() {
var _local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
if (!com.newgrounds.encoders.JSON.cache.mode) {
com.newgrounds.encoders.JSON.cache.mode = "object";
com.newgrounds.encoders.JSON.cache.pos++;
_local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
if (_local1 != "\"") {
throw "Malformed object key in encoded string. Keys must be wrapped in quotes (\"\")";
}
com.newgrounds.encoders.JSON.cache.scratch = "";
_setTargetValue({});
} else if (_local1 == ",") {
com.newgrounds.encoders.JSON.cache.pos++;
_local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
if (_local1 != "\"") {
throw "Malformed object key in encoded string. Keys must be wrapped in quotes (\"\")";
}
com.newgrounds.encoders.JSON.cache.scratch = "";
} else if (_local1 == "}") {
_useParent();
} else if (_local1 == "\"") {
com.newgrounds.encoders.JSON.cache.pos++;
_local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
if (_local1 != ":") {
throw "Malformed object notation. Object keys and values must be separated by colons(:)";
}
_addParent(com.newgrounds.encoders.JSON.cache.scratch);
com.newgrounds.encoders.JSON.cache.mode = null;
} else {
if (_local1 == "\\") {
com.newgrounds.encoders.JSON.cache.pos++;
_local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
}
com.newgrounds.encoders.JSON.cache.scratch = com.newgrounds.encoders.JSON.cache.scratch + _local1;
}
com.newgrounds.encoders.JSON.cache.pos++;
}
function _array() {
var _local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
if (!com.newgrounds.encoders.JSON.cache.mode) {
com.newgrounds.encoders.JSON.cache.mode = "array";
com.newgrounds.encoders.JSON.cache.pos++;
_local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
_setTargetValue([]);
if (_local1 != "]") {
_addArrayKey();
} else {
_useParent();
}
return(undefined);
}
if (_local1 == ",") {
_addArrayKey();
} else if (_local1 == "]") {
_useParent();
}
com.newgrounds.encoders.JSON.cache.pos++;
}
function _boolean() {
var _local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
if (_local1 == "t") {
_setTargetValue(true);
com.newgrounds.encoders.JSON.cache.pos = com.newgrounds.encoders.JSON.cache.pos + 3;
} else if (_local1 == "f") {
_setTargetValue(false);
com.newgrounds.encoders.JSON.cache.pos = com.newgrounds.encoders.JSON.cache.pos + 4;
} else {
throw "Bool values must be true or false";
}
_useParent();
}
function _null() {
var _local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
if (_local1 == "n") {
_setTargetValue(null);
com.newgrounds.encoders.JSON.cache.pos = com.newgrounds.encoders.JSON.cache.pos + 2;
} else {
throw "Null values must be null";
}
_useParent();
}
function _string() {
var _local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
if (!com.newgrounds.encoders.JSON.cache.mode) {
if (_local1 != "\"") {
throw "Strings must be wrapped in quotes (\"\")";
}
com.newgrounds.encoders.JSON.cache.scratch = "";
com.newgrounds.encoders.JSON.cache.mode = "string";
} else if (_local1 == "\"") {
_setTargetValue(com.newgrounds.encoders.JSON.cache.scratch);
_useParent();
} else {
if (_local1 == "\\") {
com.newgrounds.encoders.JSON.cache.pos++;
_local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
switch (_local1) {
case "n" :
_local1 = newline;
break;
case "r" :
_local1 = newline;
break;
case "t" :
_local1 = "\t";
break;
case "u" :
_local1 = "\\" + _local1;
}
}
com.newgrounds.encoders.JSON.cache.scratch = com.newgrounds.encoders.JSON.cache.scratch + _local1;
}
com.newgrounds.encoders.JSON.cache.pos++;
}
function _number() {
var _local1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos);
var _local2 = "01234567890.-";
if (!com.newgrounds.encoders.JSON.cache.mode) {
com.newgrounds.encoders.JSON.cache.mode = "number";
com.newgrounds.encoders.JSON.cache.scratch = "";
}
if (_local2.indexOf(_local1) < 0) {
_setTargetValue(Number(com.newgrounds.encoders.JSON.cache.scratch));
_useParent();
} else {
com.newgrounds.encoders.JSON.cache.scratch = com.newgrounds.encoders.JSON.cache.scratch + _local1;
com.newgrounds.encoders.JSON.cache.pos++;
}
}
function _setTargetValue(newval) {
var _local2 = _getParent().obj;
var _local1 = com.newgrounds.encoders.JSON.cache.parents[com.newgrounds.encoders.JSON.cache.parents.length - 1];
_local2[_local1] = newval;
}
function _useParent() {
com.newgrounds.encoders.JSON.cache.mode = com.newgrounds.encoders.JSON.getType(_getParent().obj);
com.newgrounds.encoders.JSON.cache.parents.pop();
}
function _getParent() {
var _local2 = com.newgrounds.encoders.JSON.cache;
var _local1 = 0;
while (_local1 < (com.newgrounds.encoders.JSON.cache.parents.length - 1)) {
_local2 = _local2[com.newgrounds.encoders.JSON.cache.parents[_local1]];
_local1++;
}
return({obj:_local2, name:com.newgrounds.encoders.JSON.cache.parents[_local1]});
}
function _getCurrent() {
var _local2 = com.newgrounds.encoders.JSON.cache;
var _local1 = 0;
while (_local1 < com.newgrounds.encoders.JSON.cache.parents.length) {
_local2 = _local2[com.newgrounds.encoders.JSON.cache.parents[_local1]];
_local1++;
}
return({obj:_local2, name:com.newgrounds.encoders.JSON.cache.parents[_local1]});
}
function _addParent(child) {
com.newgrounds.encoders.JSON.cache.parents.push(child);
}
function _addArrayKey() {
var _local1 = _getCurrent().obj.length;
com.newgrounds.encoders.JSON.cache.parents.push(_local1);
com.newgrounds.encoders.JSON.cache.mode = null;
}
if (cache.pos >= cache.arg.length) {
cache.complete = true;
return(undefined);
}
if (cache.mode) {
eval ("_" + cache.mode)();
} else {
var char = cache.arg.charAt(cache.pos);
switch (char) {
case "{" :
_object();
return;
case "[" :
_array();
return;
case "\"" :
_string();
return;
case "n" :
_null();
return;
case "t" :
_boolean();
return;
case "f" :
_boolean();
return;
default :
_number();
}
}
}
static function chunk_encoder() {
if (cache.complete) {
return(undefined);
}
var _local2 = getType(cache.target);
switch (_local2) {
case "number" :
cache.encoded = cache.encoded + cache.target;
getParent();
break;
case "string" :
cache.encoded = cache.encoded + (("\"" + cache.target.split("\"").join("\\\"")) + "\"");
getParent();
break;
case "boolean" :
cache.encoded = cache.encoded + ((cache.target == true) ? "true" : "false");
getParent();
break;
case "null" :
cache.encoded = cache.encoded + "null";
getParent();
break;
case "array" :
if (cache.target.length < 1) {
cache.encoded = cache.encoded + "]";
getParent();
} else {
cache.parents.push(cache.target);
cache.target = cache.target[0];
if (getType(cache.target) == "array") {
cache.encoded = cache.encoded + "[";
} else if (getType(cache.target) == "object") {
cache.encoded = cache.encoded + "{";
}
}
break;
case "object" :
for (var _local1 in cache.target) {
break;
}
if (_local1 === undefined) {
cache.encoded = cache.encoded + "}";
getParent();
} else {
cache.parents.push(cache.target);
cache.target = cache.target[_local1];
cache.encoded = cache.encoded + (("\"" + _local1.split("\"").join("\\\"")) + "\":");
if (getType(cache.target) == "array") {
cache.encoded = cache.encoded + "[";
} else if (getType(cache.target) == "object") {
cache.encoded = cache.encoded + "{";
}
}
break;
default :
cache.encoded = cache.encoded + "null";
getParent();
}
}
static function getParent() {
if (cache.parents.length > 0) {
var _local1 = cache.parents.pop();
if (getType(_local1) == "array") {
_local1.shift();
} else {
for (var _local3 in _local1) {
delete _local1[_local3];
break;
}
}
if ((getType(_local1) == "object") or (getType(_local1) == "array")) {
for (var _local2 in _local1) {
break;
}
if (!(_local2 === undefined)) {
cache.encoded = cache.encoded + ",";
}
}
cache.target = _local1;
} else {
cache.complete = true;
}
}
static var encode_chunks = 20000;
static var decode_chunks = 20000;
static var busy = false;
}
Symbol 169 MovieClip [__Packages.com.newgrounds.APIEventDispatcher] Frame 0
class com.newgrounds.APIEventDispatcher
{
function APIEventDispatcher () {
}
function addEventListener(event, callback, target) {
if (!target) {
throw "Attempted to create a listener without providing a target object.";
}
if (!listeners[event]) {
listeners[event] = [];
} else {
removeEventListener(event, target);
}
listeners[event].push({target:target, callback:callback});
}
function removeEventListener(event, target) {
if (!target) {
throw "Attempted to remove a listener without providing a target object.";
}
if ((!listeners[event]) || (listeners[event].length < 1)) {
return(undefined);
}
var _local4 = [];
var _local2 = 0;
while (_local2 < listeners[event].length) {
if (listeners[event][_local2].target != target) {
_local4.push(listeners[event][_local2]);
}
_local2++;
}
listeners[event] = _local4;
}
function dispatchEvent(event) {
if (!hasEventListener(event.__get__type())) {
return(false);
}
collectGarbage(event.__get__type());
var _local2 = 0;
while (_local2 < listeners[event.__get__type()].length) {
var _local4 = listeners[event.__get__type()][_local2].callback;
if (listeners[event.__get__type()][_local2].target) {
var _local5 = listeners[event.__get__type()][_local2].target;
_local4.call(_local5, event);
} else {
_local4(event);
}
_local2++;
}
return(true);
}
function hasEventListener(event) {
return((listeners[event] != undefined) && (listeners[event].length > 0));
}
function collectGarbage(event) {
var _local5 = [];
if (!hasEventListener) {
return(undefined);
}
var _local2 = 0;
while (_local2 < listeners[event].length) {
var _local4 = listeners[event][_local2].target;
if (_local4) {
_local5.push(listeners[event][_local2]);
}
_local2++;
}
listeners[event] = _local5;
}
var listeners = {};
}
Symbol 170 MovieClip [__Packages.com.newgrounds.encoders.MD5] Frame 0
class com.newgrounds.encoders.MD5
{
function MD5 () {
}
static function calculate(src) {
return(hex_md5(src));
}
static function hex_md5(src) {
return(binl2hex(core_md5(str2binl(src), src.length * 8)));
}
static function core_md5(x, len) {
x[len >> 5] = x[len >> 5] | (128 << (len % 32));
x[(((len + 64) >>> 9) << 4) + 14] = len;
var _local4 = 1732584193 /* 0x67452301 */;
var _local3 = -271733879;
var _local2 = -1732584194;
var _local1 = 271733878 /* 0x10325476 */;
var _local5 = 0;
while (_local5 < x.length) {
var _local10 = _local4;
var _local9 = _local3;
var _local8 = _local2;
var _local7 = _local1;
_local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 0], 7, -680876936);
_local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 1], 12, -389564586);
_local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 2], 17, 606105819);
_local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 3], 22, -1044525330);
_local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 4], 7, -176418897);
_local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 5], 12, 1200080426);
_local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 6], 17, -1473231341);
_local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 7], 22, -45705983);
_local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 8], 7, 1770035416);
_local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 9], 12, -1958414417);
_local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 10], 17, -42063);
_local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 11], 22, -1990404162);
_local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 12], 7, 1804603682);
_local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 13], 12, -40341101);
_local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 14], 17, -1502002290);
_local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 15], 22, 1236535329);
_local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 1], 5, -165796510);
_local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 6], 9, -1069501632);
_local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 11], 14, 643717713);
_local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 0], 20, -373897302);
_local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 5], 5, -701558691);
_local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 10], 9, 38016083);
_local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 15], 14, -660478335);
_local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 4], 20, -405537848);
_local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 9], 5, 568446438);
_local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 14], 9, -1019803690);
_local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 3], 14, -187363961);
_local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 8], 20, 1163531501);
_local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 13], 5, -1444681467);
_local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 2], 9, -51403784);
_local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 7], 14, 1735328473);
_local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 12], 20, -1926607734);
_local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 5], 4, -378558);
_local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 8], 11, -2022574463);
_local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 11], 16, 1839030562);
_local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 14], 23, -35309556);
_local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 1], 4, -1530992060);
_local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 4], 11, 1272893353);
_local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 7], 16, -155497632);
_local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 10], 23, -1094730640);
_local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 13], 4, 681279174);
_local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 0], 11, -358537222);
_local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 3], 16, -722521979);
_local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 6], 23, 76029189);
_local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 9], 4, -640364487);
_local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 12], 11, -421815835);
_local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 15], 16, 530742520);
_local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 2], 23, -995338651);
_local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 0], 6, -198630844);
_local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 7], 10, 1126891415);
_local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 14], 15, -1416354905);
_local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 5], 21, -57434055);
_local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 12], 6, 1700485571);
_local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 3], 10, -1894986606);
_local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 10], 15, -1051523);
_local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 1], 21, -2054922799);
_local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 8], 6, 1873313359);
_local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 15], 10, -30611744);
_local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 6], 15, -1560198380);
_local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 13], 21, 1309151649);
_local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 4], 6, -145523070);
_local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 11], 10, -1120210379);
_local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 2], 15, 718787259);
_local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 9], 21, -343485551);
_local4 = safe_add(_local4, _local10);
_local3 = safe_add(_local3, _local9);
_local2 = safe_add(_local2, _local8);
_local1 = safe_add(_local1, _local7);
_local5 = _local5 + 16;
}
return(new Array(_local4, _local3, _local2, _local1));
}
static function md5_cmn(q, a, b, x, s, t) {
return(safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b));
}
static function md5_ff(a, b, c, d, x, s, t) {
return(md5_cmn((b & c) | ((~b) & d), a, b, x, s, t));
}
static function md5_gg(a, b, c, d, x, s, t) {
return(md5_cmn((b & d) | (c & (~d)), a, b, x, s, t));
}
static function md5_hh(a, b, c, d, x, s, t) {
return(md5_cmn((b ^ c) ^ d, a, b, x, s, t));
}
static function md5_ii(a, b, c, d, x, s, t) {
return(md5_cmn(c ^ (b | (~d)), a, b, x, s, t));
}
static function bit_rol(num, cnt) {
return((num << cnt) | (num >>> (32 - cnt)));
}
static function safe_add(x, y) {
var _local1 = (x & 65535) + (y & 65535);
var _local2 = ((x >> 16) + (y >> 16)) + (_local1 >> 16);
return((_local2 << 16) | (_local1 & 65535));
}
static function str2binl(str) {
var _local3 = new Array();
var _local4 = 255;
var _local1 = 0;
while (_local1 < (str.length * 8)) {
_local3[_local1 >> 5] = _local3[_local1 >> 5] | ((str.charCodeAt(_local1 / 8) & _local4) << (_local1 % 32));
_local1 = _local1 + 8;
}
return(_local3);
}
static function binl2hex(binarray) {
var _local4 = new String("");
var _local3 = new String("0123456789abcdef");
var _local1 = 0;
while (_local1 < (binarray.length * 4)) {
_local4 = _local4 + (_local3.charAt((binarray[_local1 >> 2] >> (((_local1 % 4) * 8) + 4)) & 15) + _local3.charAt((binarray[_local1 >> 2] >> ((_local1 % 4) * 8)) & 15));
_local1++;
}
return(_local4);
}
}
Symbol 171 MovieClip [__Packages.com.newgrounds.components.FlashAd] Frame 0
class com.newgrounds.components.FlashAd extends MovieClip
{
var show_background, background, _x, _y, _xscale, _yscale, clip, mask;
function FlashAd () {
super();
background._visible = show_background;
if (show_background) {
_x = Math.round(_x);
_y = Math.round(_y);
_xscale = 100;
_yscale = 100;
}
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.ADS_APPROVED, loadAd, this);
}
function onLoad() {
com.newgrounds.API.attachFlashAd(this);
}
function loadAd(event, params) {
com.newgrounds.API.attachFlashAd(this);
}
function onUnload() {
clip.ad.unloadMovie();
clip.ad.removeMovieClip();
clip.removeMovieClip();
mask.removeMovieClip();
background.removeMovieClip();
com.newgrounds.API.removeEventListener(com.newgrounds.APIEvent.ADS_APPROVED, this);
}
}
Symbol 243 MovieClip Frame 1
stop();
Symbol 246 MovieClip Frame 17
stop();
Symbol 285 MovieClip Frame 1
stop();
Symbol 299 MovieClip Frame 1
stop();
Symbol 308 MovieClip Frame 1
stop();
Symbol 315 MovieClip Frame 1
stop();
Symbol 321 MovieClip Frame 1
stop();
Symbol 323 MovieClip Frame 1
stop();
Symbol 331 MovieClip Frame 38
stop();
Symbol 355 MovieClip Frame 1
stop();
Symbol 360 MovieClip Frame 1
stop();
Symbol 394 MovieClip Frame 1
stop();
Symbol 400 MovieClip [water] Frame 1
stop();
Symbol 400 MovieClip [water] Frame 10
removeMovieClip(this);
Symbol 425 MovieClip Frame 2
stop();
Symbol 428 MovieClip Frame 1
stop();
Symbol 433 MovieClip Frame 1
stop();
Symbol 436 MovieClip Frame 1
stop();
Symbol 444 MovieClip Frame 2
stop();
Symbol 447 MovieClip Frame 2
stop();
Symbol 499 MovieClip Frame 26
_parent._parent.random_ice(kubek_mc);
stop();
Symbol 534 MovieClip [parki] Frame 7
stop();
Symbol 547 MovieClip [space_bonus] Frame 1
stop();
Symbol 550 MovieClip [bron] Frame 5
stop();
Symbol 561 MovieClip Frame 1
stop();
Symbol 566 MovieClip Frame 1
stop();
Symbol 566 MovieClip Frame 9
_parent.removeMovieClip();
Symbol 571 MovieClip [przeciwnik2] Frame 1
stop();
Symbol 574 MovieClip [przeciwnik3] Frame 1
stop();
Symbol 576 MovieClip [przeciwnik4] Frame 1
stop();
Symbol 580 MovieClip [przeciwnik5] Frame 1
stop();
Symbol 585 MovieClip [przeciwnik6] Frame 1
stop();
Symbol 596 MovieClip Frame 1
stop();
Symbol 599 MovieClip Frame 1
stop();
Symbol 603 MovieClip Frame 1
stop();
Symbol 621 MovieClip Frame 1
stop();
Symbol 622 MovieClip [jajo] Frame 1
stop();
Symbol 622 MovieClip [jajo] Frame 16
stop();
this.removeMovieClip();
Symbol 632 MovieClip Frame 2
stop();
Symbol 639 MovieClip Frame 1
stop();
Symbol 642 MovieClip Frame 1
stop();
Symbol 645 MovieClip Frame 1
stop();
Symbol 648 MovieClip Frame 2
stop();
Symbol 651 MovieClip Frame 1
stop();
Symbol 654 MovieClip Frame 1
stop();
Symbol 663 MovieClip Frame 1
_parent._parent.select_body(this);
stop();
Symbol 663 MovieClip Frame 2
_parent._parent.select_body(this);
Symbol 663 MovieClip Frame 3
_parent._parent.select_body(this);
Symbol 663 MovieClip Frame 4
_parent._parent.select_body(this);
Symbol 663 MovieClip Frame 5
_parent._parent.select_body(this);
Symbol 663 MovieClip Frame 6
_parent._parent.select_body(this);
Symbol 678 MovieClip Frame 1
stop();
Symbol 682 MovieClip [s_chmura] Frame 1
stop();
Symbol 682 MovieClip [s_chmura] Frame 11
_parent._parent._parent.strz_remove(this);
Symbol 685 MovieClip [s_kaczka] Frame 1
stop();
Symbol 685 MovieClip [s_kaczka] Frame 11
_parent._parent._parent.strz_remove(this);
Symbol 688 MovieClip [s_kwiatek] Frame 1
stop();
Symbol 688 MovieClip [s_kwiatek] Frame 11
_parent._parent._parent.strz_remove(this);
Symbol 691 MovieClip [s_sloneczko] Frame 1
stop();
Symbol 691 MovieClip [s_sloneczko] Frame 11
_parent._parent._parent.strz_remove(this);
Symbol 708 MovieClip [music_nutka] Frame 1
stop();
Symbol 759 MovieClip [ramka] Frame 1
function begin_game(N, B) {
if (B != true) {
B = false;
}
opis_mc._visible = false;
if (N == 4) {
if (!B) {
_root.play_the_music(_root.obuwie_snd);
}
parki_begin(game_level);
} else if (N == 19) {
if (!B) {
_root.play_the_music(_root.warzywa_snd);
}
pracus_begin(game_level);
} else if (N == 30) {
if (!B) {
_root.play_the_music(_root.kwiatki_snd);
}
strazak_begin(game_level);
} else if (N == 42) {
if (!B) {
_root.play_the_music(_root.lody_snd);
}
lodziarnia_begin(game_level);
} else if (N == 50) {
if (!B) {
_root.play_the_music(_root.strzelnica_snd);
}
strzelnica_begin(game_level);
} else if (N == 58) {
if (!B) {
_root.play_the_music(_root.salongier_snd);
}
kosmos_begin(game_level);
} else if (N == 70) {
if (!B) {
_root.play_the_music(_root.gokarty_snd);
}
gokarty_begin(game_level);
} else if (N == 86) {
if (!B) {
_root.play_the_music(_root.pingpong_snd);
}
pingpong_begin(game_level);
} else if (N == 95) {
stopAllSounds();
muzyczny_begin(game_level);
} else if (N == 101) {
if (!B) {
_root.play_the_music(_root.quiz_snd);
}
ksiegarnia_begin(game_level);
}
}
function ksiegarnia_begin(IL) {
trace("[[ KSIEGARNIA LEVEL:" + IL);
p = this.attachMovie("ksiegarnia", "cont_mc", 1);
p.begin_time = 0;
p.current_time = 0;
centruj(p, 590);
p.temp_q = ksiegarnia_get_random_questions(ksiegarnia_questions[IL]);
trace("S p.temp_q.length :" + p.temp_q.length);
ask_question();
}
function ksiegarnia_get_random_questions(A) {
var _local1 = new Array();
var _local3 = A.slice();
var _local4 = ksiegarnia_levels_questions_nums[game_level];
var _local2 = 0;
while (_local1.length < _local4) {
_local2 = Math.floor(Math.random() * (_local3.length - 1));
_local1.push(_local3.splice(_local2, 1)[0]);
}
return(_local1);
}
function ksiegarnia_time_count() {
p.current_time = p.max_time - Math.round((getTimer() - p.begin_time) / 1000);
moves_txt.text = (_root.lang_arr.bookstore_waiting_1 + p.current_time) + _root.lang_arr.bookstore_waiting_1;
if (p.current_time <= 0) {
ksiegarnia_clear_btn();
ksiegarnia_end(_root.lang_arr.bookstore_time_end);
}
}
function ask_question() {
clearInterval(intek);
delete p.onEnterFrame;
p.begin_time = getTimer();
p.current_time = 0;
p.max_time = ksiegarnia_levels_times[game_level];
p.onEnterFrame = function () {
ksiegarnia_time_count();
};
if (p.temp_q.length == 0) {
trace("KONIEC QUIZU");
addMiniPoints(game_level * 10);
if (game_level >= 5) {
addMiniPoints(50);
clear_arr(false, "quiz");
} else {
want_play_more();
clear_arr(true, "quiz");
}
return(true);
}
var _local6 = Math.floor(Math.random() * (p.temp_q.length - 1));
trace("p.temp_q.length:" + p.temp_q.length);
trace("RAND:" + _local6);
var _local5 = new Array();
_local5 = p.temp_q.splice(_local6, 1);
trace("T len:" + _local5.length);
var o = _local5[0];
var _local3 = 1;
while (_local3 <= 3) {
var _local4 = p[("r" + _local3) + "_mc"];
_local4.t_txt.text = o["o" + _local3];
_local4.num = _local3;
_local4.onRelease = function () {
if (this.num == o.odp) {
trace("DOBRA ODPOWIED\u0179");
intek = setInterval(ask_question, 1000);
moves_txt.text = _root.lang_arr.bookstore_good_answer;
ksiegarnia_clear_btn();
} else {
trace("B\u0141\u0118DNA ODPOWIED\u0179");
moves_txt.text = _root.lang_arr.bookstore_wrong_answer;
ksiegarnia_end(_root.lang_arr.bookstore_info_wrong_answer);
}
};
_local3++;
}
p.question_txt.text = o.q;
return(false);
}
function ksiegarnia_clear_btn() {
delete p.onEnterFrame;
var _local1 = 1;
while (_local1 <= 3) {
var _local2 = p[("r" + _local1) + "_mc"];
delete _local2.onRelease;
_local1++;
}
}
function ksiegarnia_end(S) {
clearMiniPoints();
showEndScreen(S, 3, reason_lost);
clear_arr(true, "quiz");
}
function muzyczny_begin(IL) {
p = this.attachMovie("muzyczny", "cont_mc", 1);
centruj(p, 610);
p.ramka_mc.swapDepths(20);
p.speed = 600;
p.cant_click = false;
music_create_soundmc();
music_clear_all();
music_begin_play();
var _local2 = 1;
while (_local2 <= 12) {
var _local3 = music_get_name(_local2);
_local3.num = _local2;
_local3.onRelease = function () {
if ((!p.music_playing) && (!p.cant_click)) {
trace("USER CLICK:" + this.num);
music_add_user_click(this.num);
music_key_show(this.num);
}
};
_local2++;
}
}
function music_begin_play() {
moves_txt.text = _root.lang_arr.musicstore_listen;
clearInterval(intek);
var _local3 = p.createEmptyMovieClip("sndimg", 99000);
_local3._y = 200;
p.cur_k = 1;
p.music_rep = new Array("");
p.music_playing = true;
var _local2 = 1;
while (_local2 <= music_levels_addons[game_level]) {
p.music.push(music_add());
_local2++;
}
intek = setInterval(music_show, p.speed);
}
function music_clear_all(B) {
if (B) {
clearMiniPoints();
showEndScreen(_root.lang_arr.musicstore_last_was_wrong, 3, reason_lost);
clear_arr(true, "muzyczny");
}
clearInterval(intek);
p.music_playing = false;
p.last_k = 0;
p.music = new Array("");
}
function music_show() {
var _local1 = p.music[p.cur_k];
music_key_show(_local1);
p.last_k = _local1;
var _local2 = p.music.length;
p.cur_k++;
if (p.cur_k >= _local2) {
clearInterval(intek);
intek = setInterval(music_user_play, 800);
}
music_add_sound_image();
}
function music_create_soundmc() {
var _local2;
var _local3;
var _local1 = 1;
while (_local1 <= 12) {
_local2 = p.createEmptyMovieClip(("m" + _local1) + "_mc", -_local1);
keyboardSounds[_local1] = new Sound(_local2);
keyboardSounds[_local1].attachSound("m" + _local1);
_local1++;
}
}
function music_key_show(N) {
p.music_playing = true;
var _local1 = 1;
while (_local1 <= 12) {
var _local2 = music_get_name(_local1);
if (_local1 < 8) {
_local2.swapDepths(-_local1);
} else {
_local2.swapDepths(_local1);
}
_local1++;
}
var _local4 = music_get_name(N);
if (N < 8) {
_local4.swapDepths(1);
}
_local4.gotoAndStop(2);
keyboardSounds[N].start(0, 1);
cl = setInterval(music_hide, p.speed - 100, N);
}
function music_user_play() {
moves_txt.text = _root.lang_arr.musicstore_repeat_melody;
clearInterval(intek);
music_enable_btn(true);
trace("TERAZ USER GRA");
}
function music_add_user_click(N) {
p.music_rep.push(N);
var _local1 = false;
if (p.music_rep[p.music_rep.length - 1] == p.music[p.music_rep.length - 1]) {
p.sndimg["n" + p.music_rep.length].gotoAndStop(2);
_local1 = true;
} else {
p.cant_click = true;
p.sndimg["n" + p.music_rep.length].gotoAndStop(3);
intek = setInterval(music_clear_all, p.speed, true);
}
if ((p.music_rep.length >= p.music.length) && (_local1)) {
if (p.music_rep.length > music_levels_length[game_level]) {
trace("KONIEC POZIOMU");
p.cant_click = true;
intek = setInterval(music_finish_this_part, 1000);
} else {
intek = setInterval(music_begin_play, p.speed);
}
}
}
function music_finish_this_part() {
addMiniPoints(game_level * 10);
if (game_level >= 5) {
addMiniPoints(50);
clear_arr(false, "muzyczny");
} else {
want_play_more();
clear_arr(true, "muzyczny");
}
}
function music_check_prop() {
var _local2 = true;
var _local1 = 1;
while (_local1 <= p.music.length) {
if (p.music[_local1] != p.music_rep[_local1]) {
_local2 = false;
}
_local1++;
}
return(_local2);
}
function music_enable_btn(B) {
var _local1 = 1;
while (_local1 <= 12) {
var _local2 = music_get_name(_local1);
_local2.enabled = B;
_local1++;
}
}
function music_hide(N) {
var _local1 = music_get_name(N);
_local1.gotoAndStop(1);
clearInterval(cl);
p.music_playing = false;
}
function music_get_name(N) {
return(p["k" + N]);
}
function music_add() {
var _local1 = Math.ceil(Math.random() * 12);
return(_local1);
}
function music_add_sound_image() {
var _local2 = p.sndimg;
var _local1 = _local2.attachMovie("music_nutka", "n" + p.cur_k, p.cur_k);
_local1._x = (p.cur_k - 1) * _local1._width;
}
function pingpong_begin(IL) {
_root.hala1_snd.setVolume(30);
p = this.attachMovie("pingpong", "cont_mc", 1);
p.ball_start = false;
p.ball_time_begin = 3;
p.hits_num = 0;
p.wind_right._visible = false;
p.wind_left._visible = false;
centruj(p, 650, 240);
var _local3 = p.men_mc;
_local3.gotoAndStop(_root.pionek_type);
_local3.speed = 5;
_local3.onEnterFrame = function () {
if (Key.isDown(37)) {
if ((this._x - this.speed) < 10) {
this._x = 10;
} else {
this._x = this._x - this.speed;
}
} else if (Key.isDown(39)) {
if ((this._x + this.speed) > 460) {
this._x = 460;
} else {
this._x = this._x + this.speed;
}
}
};
var pl = p.ball_mc;
pl.pal = {xx:39, ww:24, yy:-45};
pl.graw = 1 * pingpong_low;
pl.yspeed = 0;
pl.maxyspeed = ping_balls_maxyspeed[IL] * pingpong_low;
pl.men = _local3;
pl.py = pl.men._y + pl.pal.yy;
if (Math.random() < 0.5) {
pl.wind = -ping_winds[IL];
} else {
pl.wind = ping_winds[IL];
}
if (Math.abs(pl.wind) > 0) {
if (pl.wind > 0) {
p.wind_left._visible = true;
} else {
p.wind_right._visible = true;
}
}
pl.xspeed = 0 + pl.wind;
pl.onEnterFrame = function () {
if (p.ball_start) {
var _local4 = false;
if (((this._x >= (pl.men._x + this.pal.xx)) && (this._x <= ((pl.men._x + this.pal.xx) + this.pal.ww))) && (this._y <= this.py)) {
_local4 = true;
}
if (((this._y + this.yspeed) > this.py) && (_local4)) {
this._y = this.py;
var _local5 = (this.men._x + this.pal.xx) + (this.pal.ww / 2);
var _local3 = 0.005 - (Math.random() / 100);
if (_local3 == 0) {
_local3 = 0.005;
}
this.xspeed = (((((-_local5) + this._x) / 2) + _local3) + this.wind) * Math.min(1, (IL / 10) + 0.4);
this.yspeed = -1 * pl.maxyspeed;
pingpong_points_display(++p.hits_num);
if (_root.musicOK) {
_root.hala2_snd.start(0.1, 1);
}
} else {
trace("this.wind:" + this.wind);
this._x = this._x + this.xspeed;
this.yspeed = this.yspeed + this.graw;
this._y = this._y + this.yspeed;
}
if (this._y > 240) {
clearMiniPoints();
showEndScreen(_root.lang_arr.pingpong_last_was_wrong, 3, reason_lost);
clear_arr(true, "hala");
if (_root.musicOK) {
_root.hala1_snd.start(0, 1);
}
}
}
};
pingpong_display_begin();
intek = setInterval(pingpong_display_begin, 1000);
var _local8 = new Date();
var _local9 = pingpong_hours_display(_local8.getHours());
var _local7 = pingpong_hours_display(_local8.getMinutes());
var _local4 = p.tabl_mc;
_local4.t1_mc.gotoAndStop(_local9.n1);
_local4.t2_mc.gotoAndStop(_local9.n2);
_local4.t3_mc.gotoAndStop(_local7.n1);
_local4.t4_mc.gotoAndStop(_local7.n2);
}
function pingpong_points_display(N) {
var _local1 = String(N);
var _local2 = new Object();
if (_local1.length == 3) {
_local2 = {p1:Number(_local1.charAt(0)), p2:Number(_local1.charAt(1)), p3:Number(_local1.charAt(2))};
} else if (_local1.length == 2) {
_local2 = {p1:"0", p2:Number(_local1.charAt(0)), p3:Number(_local1.charAt(1))};
} else if (_local1.length == 1) {
_local2 = {p1:"0", p2:"0", p3:Number(_local1)};
}
var _local3 = p.tabl_mc;
_local3.p1_mc.gotoAndStop(_local2.p1 + 1);
_local3.p2_mc.gotoAndStop(_local2.p2 + 1);
_local3.p3_mc.gotoAndStop(_local2.p3 + 1);
if (N >= ping_hitballs_times[game_level]) {
addMiniPoints(game_level * 10);
if (game_level >= 5) {
addMiniPoints(50);
clear_arr(false, "hala");
} else {
want_play_more();
clear_arr(true, "hala");
}
}
}
function pingpong_hours_display(N) {
var _local2 = "";
var _local1 = String(N);
if (_local1.length == 1) {
_local2 = "0";
} else {
_local2 = _local1.charAt(0);
_local1 = _local1.charAt(1);
}
return({n1:Number(_local2) + 1, n2:Number(_local1) + 1});
}
function pingpong_display_begin() {
moves_txt.text = ((_root.lang_arr.pingpong_hit_the_ball_1 + ping_hitballs_times[game_level]) + _root.lang_arr.pingpong_hit_the_ball_2) + p.ball_time_begin;
if (p.ball_time_begin <= 0) {
moves_txt.text = _root.lang_arr.pingpong_start;
p.ball_start = true;
clearInterval(intek);
}
p.ball_time_begin--;
if (_root.musicOK) {
_root.gocarty1_snd.start(0, 1);
}
}
function gokarty_begin(LI) {
p = this.attachMovie("gokarty", "cont_mc", 1);
centruj(p, 810, 240);
p.bg_mc.gotoAndStop(LI);
p.bg_mc._y = -110;
p.bg_mc.cacheAsBitmap();
p.turndrag = 0.5;
p.turnrate = 8;
p.drag = 0.88;
p.skid = 0.65;
p.can_move = false;
p.start_num = 3;
p.loops1 = 0;
p.loops2 = 0;
p.current_time = 0;
p.result_time = 0;
p.f1_hit = true;
p.f2_hit = false;
p.f1_hit2 = true;
p.f2_hit2 = false;
p.max_loops = 5;
gokarty_lap_display();
p.begin_volume = 1;
p.max_volume = 20;
var _local3 = p.p1_mc;
_local3.turnspeed = (_local3.curspeed = (_local3.xspeed = (_local3.yspeed = (_local3.rad = 0))));
_local3.speed = 0.4;
_local3.max_speed = 3;
_local3.slowrate = 0.1;
_local3.onEnterFrame = function () {
if (p.can_move) {
gokarty_time();
steering_car(this);
move_car(this, p);
}
};
var _local4 = p.bg_mc.p2_mc;
_local4.current_point = 1;
_local4.max_point = 19;
_local4._rotation = -90;
_local4.cur_speed = 0;
_local4.max_speed = gokarty_op_speeds[LI];
_local4.velocity = gokarty_op_velocity[LI];
_local4.rot_speed = 10;
_local4.onEnterFrame = function () {
if (p.can_move) {
this.cur_speed = this.cur_speed + this.velocity;
if (this.cur_speed > this.max_speed) {
this.cur_speed = this.max_speed;
}
var _local3 = p.bg_mc["k" + this.current_point];
var _local8 = (180 * _root.get_dir(this, _local3).c) / Math.PI;
dir_check(this, this.rot_speed, _local8);
var _local4 = (this._rotation * Math.PI) / 180;
var _local9 = (-this.cur_speed) * Math.cos(_local4);
var _local7 = (-this.cur_speed) * Math.sin(_local4);
this._x = this._x + _local9;
this._y = this._y + _local7;
if (this.hitTest(_local3)) {
this.current_point++;
}
if (this.current_point > this.max_point) {
this.current_point = 1;
}
var _local6 = this._parent.f1_mc;
var _local5 = this._parent.f2_mc;
if (this.hitTest(_local6) && (p.f2_hit2)) {
p.f2_hit2 = false;
p.f1_hit2 = true;
p.loops2++;
gokarty_lap_display();
if (p.loops2 >= p.max_loops) {
clearMiniPoints();
showEndScreen(_root.lang_arr.gokarty_wrong, 3, reason_lost);
clear_arr(true, "gokarty");
}
} else if (this.hitTest(_local5) && (p.f1_hit2)) {
p.f2_hit2 = true;
p.f1_hit2 = false;
}
}
};
gokarty_starting();
intek = setInterval(gokarty_starting, 1000);
}
function gokarty_starting() {
if (p.start_num > 0) {
moves_txt.text = p.start_num;
p.start_num--;
} else if (p.start_num == -1) {
clearInterval(intek);
p.start_time = getTimer();
p.can_move = true;
moves_txt.text = p.current_time;
} else {
moves_txt.text = _root.lang_arr.gokarty_start;
p.start_num = -1;
}
if (_root.musicOK) {
_root.gocarty1_snd.start(0, 1);
}
}
function gokarty_time() {
p.current_time = getTimer() - p.start_time;
moves_txt.text = display_time_prepared(p.current_time);
}
function display_time_prepared(NUM) {
var _local5 = Math.round((NUM % 1000) / 10);
var _local1 = String(_local5);
if (_local1.length == 1) {
_local1 = "0" + _local1;
}
var _local3 = Math.round(NUM / 1000);
var _local6 = Math.floor(_local3 / 60);
var _local4 = Math.round(_local3 % 60);
var _local2 = String(_local4);
if (_local2.length == 1) {
_local2 = "0" + _local2;
}
return((((("0" + _local6) + " : ") + _local2) + " : ") + _local1);
}
function gokarty_lap_display() {
p.lap1_txt.text = (p.loops1 + "/") + p.max_loops;
p.lap2_txt.text = (p.loops2 + "/") + p.max_loops;
}
function steering_car(MC) {
if (Key.isDown(37)) {
if (MC.curspeed > 0.05) {
MC.turnspeed = MC.turnspeed - p.turnrate;
}
} else if (Key.isDown(39)) {
if (MC.curspeed > 0.05) {
MC.turnspeed = MC.turnspeed + p.turnrate;
}
}
if (Key.isDown(38)) {
MC.curspeed = MC.curspeed + MC.speed;
}
if (Key.isDown(40)) {
if (MC.curspeed > 0) {
MC.curspeed = MC.curspeed - MC.slowrate;
}
}
}
function move_bg(CAR, V) {
var _local2 = CAR;
var _local1 = V.bg_mc;
var _local4 = _local1._x;
_local1._x = _local1._x - _local2.xspeed;
var _local5 = _local1._x;
var _local3 = _local1._y;
_local1._y = _local1._y - _local2.yspeed;
var _local6 = _local1._y;
}
function car_hits(CAR) {
var _local1 = CAR;
var _local7 = p.bg_mc.col_mc;
var _local13 = _local1.l_d_mc;
var _local9 = _local1.r_d_mc;
var _local14 = _local1.l_u_mc;
var _local10 = _local1.r_u_mc;
var _local5 = new Object({x:_local13._x, y:_local13._y});
var _local4 = new Object({x:_local9._x, y:_local9._y});
var _local3 = new Object({x:_local14._x, y:_local14._y});
var _local2 = new Object({x:_local10._x, y:_local10._y});
CAR.localToGlobal(_local5);
CAR.localToGlobal(_local4);
CAR.localToGlobal(_local3);
CAR.localToGlobal(_local2);
if (_local7.hitTest(_local5.x, _local5.y, true) && (_local7.hitTest(_local4.x, _local4.y, true))) {
_local1.curspeed = -Math.abs(_local1.curspeed);
} else if (_local7.hitTest(_local5.x, _local5.y, true)) {
_local1._rotation = _local1._rotation - 10;
_local1.curspeed = _local1.curspeed * 0.15;
} else if (_local7.hitTest(_local4.x, _local4.y, true)) {
_local1._rotation = _local1._rotation + 10;
_local1.curspeed = _local1.curspeed * 0.15;
}
var _local6 = p.bg_mc.p2_mc;
if (_local6.hitTest(_local5.x, _local5.y, true) || (_local6.hitTest(_local4.x, _local4.y, true))) {
_local1.curspeed = 0;
} else if (_local6.hitTest(_local3.x, _local3.y, true) || (_local6.hitTest(_local2.x, _local2.y, true))) {
_local6.cur_speed = 0;
}
var _local12 = p.bg_mc.f1_mc;
var _local11 = p.bg_mc.f2_mc;
if ((_local12.hitTest(_local3.x, _local3.y, true) || (_local12.hitTest(_local2.x, _local2.y, true))) && (p.f2_hit)) {
p.f2_hit = false;
p.f1_hit = true;
p.loops1++;
gokarty_lap_display();
if (p.loops1 >= p.max_loops) {
p.result_time = p.current_time;
var _local15 = Math.round((100000 - p.result_time) / 1000);
addMiniPoints((game_level * 10) + Math.max(_local15, 0));
trace("C PONTS:" + points);
if (game_level >= 5) {
addMiniPoints(50);
clear_arr(false, "gokarty");
} else {
want_play_more();
clear_arr(true, "gokarty");
}
}
} else if ((_local11.hitTest(_local3.x, _local3.y, true) || (_local11.hitTest(_local2.x, _local2.y, true))) && (p.f1_hit)) {
p.f1_hit = false;
p.f2_hit = true;
}
}
function move_car(CAR, V) {
var _local1 = CAR;
car_hits(CAR);
_local1.turnspeed = _local1.turnspeed * V.turndrag;
_local1.curspeed = _local1.curspeed * V.drag;
if (_local1.curspeed > _local1.max_speed) {
_local1.curspeed = _local1.max_speed;
}
_local1.xspeed = _local1.xspeed * V.skid;
_local1.yspeed = _local1.yspeed * V.skid;
_local1.xspeed = _local1.xspeed + (Math.cos(_local1.rad) * _local1.curspeed);
_local1.yspeed = _local1.yspeed + (Math.sin(_local1.rad) * _local1.curspeed);
_local1._rotation = _local1._rotation + _local1.turnspeed;
move_bg(CAR, V);
_local1.rad = (_local1._rotation - 90) / 57.2957795130823;
}
function dir_check(OB, SPEED, NEW_DIR) {
var _local1 = NEW_DIR;
var _local3 = OB._rotation;
if ((_local3 == 0) || (_local3 == 180)) {
if (_local3 == 0) {
if (_local1 > 0) {
OB._rotation = OB._rotation + SPEED;
} else if (_local1 < 0) {
OB._rotation = OB._rotation - SPEED;
} else {
OB._rotation = _local1;
}
} else if (_local1 < 0) {
OB._rotation = OB._rotation + SPEED;
} else if (_local1 > 0) {
OB._rotation = OB._rotation - SPEED;
} else {
OB._rotation = _local1;
}
} else if ((_local3 > 0) && (_local1 > 0)) {
if (_local3 > _local1) {
OB._rotation = OB._rotation - SPEED;
} else if (_local3 < _local1) {
OB._rotation = OB._rotation + SPEED;
} else {
OB._rotation = _local1;
}
} else if ((_local3 < 0) && (_local1 < 0)) {
if (_local3 < _local1) {
OB._rotation = OB._rotation + SPEED;
} else if (_local3 > _local1) {
OB._rotation = OB._rotation - SPEED;
} else {
OB._rotation = _local1;
}
} else if ((_local3 < 0) && (_local1 > 0)) {
if ((Math.abs(_local3) + Math.abs(_local1)) < 180) {
OB._rotation = OB._rotation + SPEED;
} else if (Math.abs(_local3 + _local1) < 180) {
OB._rotation = OB._rotation - SPEED;
}
} else if ((_local3 > 0) && (_local1 < 0)) {
if ((Math.abs(_local3) + Math.abs(_local1)) < 180) {
OB._rotation = OB._rotation - SPEED;
} else if (Math.abs(_local3 + _local1) < 180) {
OB._rotation = OB._rotation + SPEED;
}
}
if (Math.abs(_local3 - _local1) < SPEED) {
OB._rotation = _local1;
}
}
function kosmos_begin(LI) {
p = this.attachMovie("kosmos", "cont_mc", 1);
p.weapon = new Array("", {speed:4, str:1, freq:15, bullets:0}, {speed:6, str:2, freq:11, bullets:20}, {speed:8, str:3, freq:9, bullets:15}, {speed:10, str:5, freq:6, bullets:15}, {speed:12, str:5, freq:4, bullets:10});
p.max_depth = 100;
p.ships_deleted = 0;
p.first_time_ship = true;
space_txt_updates();
p.op_depth = 0;
p.op_bullets_depth = 0;
p.max_delete = 5;
p.our_lifes_ended = false;
centruj(p, 580, 240);
space_add_our_ship();
intek = setInterval(space_add_opponent_rand, 1000);
}
function space_add_our_ship() {
var _local2 = p.space_mc.attachMovie("statek", "ship_mc", 1, {_x:p.left_mc._x + 25, _y:p.up_mc._y + 100});
_local2.shooting_space = 0;
_local2.bullets_type = 1;
_local2.bullets_num = p.weapon[_local2.bullets_type].bullets;
_local2.shooting_freq = p.weapon[_local2.bullets_type].freq;
space_move_updates();
space_txt_updates();
_local2.cant_delete = 6;
if (!p.first_time_ship) {
_local2.cant_delete = 1;
_local2.showingIntek = setInterval(space_hide_show, 200, _local2);
}
p.first_time_ship = false;
steering(_local2, 0, 0.8, 0.83, _local2._width / 2, _local2._height / 2);
_local2.onEnterFrame = function () {
celownik_move(this, false);
if (Key.isDown(32) && (this.shooting_space > this.shooting_freq)) {
this.shooting_space = 0;
space_shoot(this, this.bullets_type);
}
this.shooting_space++;
};
}
function space_hide_show(MC) {
if (MC._alpha == 100) {
MC._alpha = 50;
} else {
MC._alpha = 100;
MC.cant_delete++;
}
if (MC.cant_delete > p.max_delete) {
clearInterval(MC.showingIntek);
}
}
function space_txt_updates() {
p.level_txt.text = _root.lang_arr.space_level + game_level;
p.lives_txt.text = _root.lang_arr.space_lives + space_lives;
p.points_txt.text = _root.lang_arr.space_points + points;
p.bonus_mc.gotoAndStop(p.space_mc.ship_mc.bullets_type);
}
function space_move_updates() {
if (p.space_mc.ship_mc.bullets_type == 1) {
moves_txt.text = "";
} else {
moves_txt.text = _root.lang_arr.space_bullets_num + p.space_mc.ship_mc.bullets_num;
}
}
function space_add_opponent_rand() {
if (p.ships_deleted >= space_ships[game_level]) {
space_add_opponent(6);
clearInterval(intek);
} else {
var _local1 = 1 + Math.round(Math.random() * game_level);
space_add_opponent(_local1);
}
}
function space_add_opponent(TYPE, BY) {
p.ships_deleted++;
var _local3 = p.opponents_mc.attachMovie("przeciwnik" + TYPE, "p" + (p.op_depth++), p.op_depth);
_local3._x = 650;
if (BY == undefined) {
_local3._y = 40 + (Math.random() * 160);
} else {
_local3._y = BY;
}
_local3.yspeed = TYPE;
_local3.addbonus = false;
if (TYPE == 1) {
_local3.strong = 1;
_local3.speed = 2;
_local3.onEnterFrame = function () {
this._x = this._x - this.speed;
if (this._x < 100) {
space_del(this);
}
space_collision_check(this, p.bullets_mc);
space_op_collision(this);
};
} else if (TYPE == 2) {
_local3.strong = 2;
_local3.speed = 4;
_local3.onEnterFrame = function () {
this._x = this._x - this.speed;
var _local2 = 2.5 - (Math.random() * 5);
if ((this._y + _local2) > (p.down_mc._y - 20)) {
_local2 = 0;
}
if ((this._y + _local2) < (p.up_mc._y - 20)) {
_local2 = 0;
}
this._y = this._y + _local2;
if (this._x < 100) {
space_del(this);
}
space_collision_check(this, p.bullets_mc);
space_op_collision(this);
};
} else if (TYPE == 5) {
_local3.strong = 3;
space_new_dir(_local3);
_local3.onEnterFrame = function () {
if (_root.move_it(this.movex, this.movey, 13, this)) {
space_op_shoot(this);
space_new_dir(this);
}
space_collision_check(this, p.bullets_mc);
space_op_collision(this);
};
} else if (TYPE == 6) {
trace("BOSSS");
_local3.strong = (10 * game_level) + 20;
space_new_dir(_local3);
_local3.onEnterFrame = function () {
if (_root.move_it(this.movex, this.movey, 10, this)) {
space_op_shoot(this, -10);
space_op_shoot(this, 10);
space_new_dir(this);
}
space_collision_check(this, p.bullets_mc);
space_op_collision(this);
};
} else {
_local3.strong = 2;
_local3.speed = TYPE;
_local3.onEnterFrame = function () {
this._x = this._x - this.speed;
this._y = this._y + this.yspeed;
if ((this._y > (p.down_mc._y - 20)) || (this._y < (p.up_mc._y + 20))) {
this.yspeed = this.yspeed * -1;
}
if (this._x < 100) {
space_del(this);
}
space_collision_check(this, p.bullets_mc);
space_op_collision(this);
};
}
if (TYPE != 6) {
if (Math.random() < 0.1) {
_local3.addbonus = true;
}
}
}
function space_op_collision(MC) {
if (MC.hitTest(p.space_mc.ship_mc.col_mc) && (p.space_mc.ship_mc.cant_delete > p.max_delete)) {
space_end_life();
if (MC.yspeed != 6) {
space_del(MC, true);
}
if (_root.musicOK) {
_root.salongier2_snd.start(0, 1);
}
}
}
function space_op_shoot(MC, DISTY) {
if ((DISTY == null) || (DISTY == undefined)) {
DISTY = 0;
}
var _local2 = p.bullets_op_mc.attachMovie("bron", "b" + (p.op_bullets_depth++), p.op_bullets_depth);
_local2.gotoAndStop(1);
_local2._x = MC._x;
_local2._y = MC._y + DISTY;
_local2.speed = 8;
_local2._xscale = -100;
_local2.onEnterFrame = function () {
this._x = this._x - this.speed;
if (this._x < p.left_mc._x) {
space_del(this);
}
if (this.hitTest(p.space_mc.ship_mc.col_mc) && (p.space_mc.ship_mc.cant_delete > p.max_delete)) {
space_del(this);
space_end_life();
}
};
if (p.op_bullets_depth > p.max_depth) {
p.op_bullets_depth = 0;
}
}
function space_add_bonus() {
var nzw = p.opponents_mc.attachMovie("space_bonus", "bonus_" + (p.op_depth++), p.op_depth, {_x:650, _y:40 + (Math.random() * 160)});
nzw.speed = 2;
var _local3 = Math.ceil(Math.random() * nzw._totalframes);
if ((space_lives >= 3) && (_local3 == 5)) {
_local3 = Math.ceil(Math.random() * 4);
}
nzw.gotoAndStop(_local3);
trace("ADDING BONUS:" + nzw._currentframe);
nzw.onEnterFrame = function () {
this._x = this._x - this.speed;
if (this._x < 100) {
space_del(this);
}
if (this.hitTest(p.space_mc.ship_mc)) {
if (nzw._currentframe < 5) {
p.space_mc.ship_mc.bullets_type = nzw._currentframe + 1;
p.space_mc.ship_mc.bullets_num = p.weapon[p.space_mc.ship_mc.bullets_type].bullets;
} else if (nzw._currentframe == 5) {
space_lives++;
} else if (nzw._currentframe == 6) {
addMiniPoints(10);
}
space_txt_updates();
space_move_updates();
if (_root.musicOK) {
_root.warzywniak4_snd.start(0, 1);
}
space_del(this);
}
};
}
function space_new_dir(MC) {
MC.movex = 300 + (Math.random() * 220);
MC.movey = 30 + (Math.random() * 170);
}
function space_collision_check(OP, BUL) {
if (OP.hitTest(BUL)) {
for (var _local5 in BUL) {
var _local3 = BUL[_local5];
if (OP.hitTest(_local3) && (!p.our_lifes_ended)) {
space_del(_local3);
OP.strong = OP.strong - p.weapon[p.space_mc.ship_mc.bullets_type].str;
if (OP.strong <= 0) {
if (OP.addbonus) {
space_add_bonus();
}
addMiniPoints(Math.abs(OP.yspeed));
space_del(OP, true);
space_txt_updates();
if (_root.musicOK) {
_root.salongier2_snd.start(0, 1);
}
} else {
OP.gotoAndPlay(2);
}
}
}
}
}
function space_del(MC, B) {
delete MC.onEnterFrame;
if (B) {
MC.blow_mc.play();
MC.blow2_mc.play();
MC.blow_mc.onEnterFrame = function () {
if (this._parent._name == "ship_mc") {
if (this._currentframe >= this._totalframes) {
if (space_lives > 0) {
space_add_our_ship();
} else {
p.our_lifes_ended = true;
clearMiniPoints();
showEndScreen(_root.lang_arr.space_time_over, 3, reason_lost);
clear_arr(true, "strzelnica");
}
this.stop();
delete this.onEnterFrame;
}
}
if (this._parent.yspeed == 6) {
if (this._currentframe >= (this._totalframes - 1)) {
if (game_level >= 5) {
addMiniPoints(50);
clear_arr(false, "salongier");
} else {
addMiniPoints(10);
want_play_more();
clear_arr(true, "salongier");
}
this.stop();
delete this.onEnterFrame;
}
}
};
} else {
removeMovieClip(MC);
}
}
function space_shoot(MC, WT) {
if (_root.musicOK) {
_root.salongier1_snd.start(0, 1);
}
var _local3 = p.bullets_mc.attachMovie("bron", "b" + (d++), d);
_local3.gotoAndStop(WT);
_local3._x = (MC._x + 24) + (_local3._width / 2);
_local3._y = MC._y;
_local3.speed = p.weapon[WT].speed;
_local3.str = p.weapon[WT].str;
_local3.onEnterFrame = function () {
this._x = this._x + this.speed;
if (this._x > p.right_mc._x) {
space_del(this);
}
};
if (d > p.max_depth) {
d = 0;
}
trace("shooting");
p.space_mc.ship_mc.bullets_num--;
if (p.space_mc.ship_mc.bullets_num <= 0) {
p.space_mc.ship_mc.bullets_type = 1;
}
space_txt_updates();
space_move_updates();
}
function space_end_life() {
trace("STRATA ZYCIA");
space_lives--;
space_txt_updates();
p.space_mc.ship_mc.cant_delete = 1;
space_del(p.space_mc.ship_mc, true);
}
function strzelnica_begin(LI) {
p = this.attachMovie("strzelnica", "cont_mc", 1);
p.all_items = new Array();
p.can_play = true;
add_items(LI);
trace("ALL IT:" + p.all_items.length);
p.strzalow = 6;
display_BulletsNum();
p.zestrzelonych = 0;
centruj(p, 655, 245);
var _local3 = p.createEmptyMovieClip("c_mc", 0);
var _local2 = _local3.attachMovie("celownik", "c", 0, {_x:275, _y:125});
steering(_local2, 0.2, 2.5, 0.83, _local2._width / 2, _local2._height / 2);
intek = setInterval(strz_all, 33, _local2);
Key.addListener(_local2);
_local2.onKeyUp = function () {
if (Key.getCode() == 32) {
this.can_shot = true;
}
};
}
function strz_all(MC) {
celownik_move(MC, false);
if (Key.isDown(32) && (MC.can_shot)) {
MC.can_shot = false;
p.c_mc.c.shot_mc.play();
shooted_check(MC);
}
}
function strz_remove(MC) {
removeMovieClip(MC);
}
function shooted_check(MC) {
p.strzalow--;
if (_root.musicOK) {
_root.strzelnica1_snd.start(0, 1);
}
display_BulletsNum();
for (var _local4 in p.all_items) {
var _local2 = p.all_items[_local4];
if (_local2.hitTest(MC._x + p.xmov, MC._y + p.ymov, true)) {
_local2.gotoAndPlay(2);
p.zestrzelonych++;
if (p.zestrzelonych >= p.all_items.length) {
strz_koniec(_root.lang_arr.strz_level_over, true);
return(true);
}
}
}
if (p.strzalow <= 0) {
strz_koniec(_root.lang_arr.strz_bullets_over, false);
}
}
function strz_koniec(ST, B) {
trace(ST);
p.can_play = false;
clearInterval(intek);
if (B) {
if (game_level >= 5) {
trace("Przeszed\u0142e\u015B wszystkie poziomy");
addMiniPoints(50);
clear_arr(false, "strzelnica");
} else {
trace("Czy chcesz gra\u0107 dalej");
addMiniPoints((game_level * 10) + ((game_level * 5) * p.strzalow));
want_play_more();
clear_arr(true, "strzelnica");
}
} else {
trace("Koniec gry");
for (var _local3 in p.all_items) {
var _local2 = p.all_items[_local3];
delete _local2.onEnterFrame;
}
clearMiniPoints();
showEndScreen(_root.lang_arr.strz_bullets_game_over, 3, reason_lost);
clear_arr(true, "strzelnica");
}
}
function add_items(N) {
if (N == 1) {
p.all_items.push(add_falling(p.lad_mc.attachMovie("s_kwiatek", "k1", 1, {_x:350, _y:150}), 4, 3, 15));
p.all_items.push(add_falling(p.niebo_mc.attachMovie("s_sloneczko", "k2", 2, {_x:150, _y:40}), 3, 2, 10));
} else if (N == 2) {
p.all_items.push(add_falling(p.woda_mc.attachMovie("s_kaczka", "k1", 1, {_x:200 + (Math.random() * 50), _y:180, _xscale:-100}), 3, 3, 15));
p.all_items.push(add_falling(p.niebo_mc.attachMovie("s_sloneczko", "k2", 2, {_x:400, _y:50}), 4, 2, 15));
p.all_items.push(add_falling(p.lad_mc.attachMovie("s_kwiatek", "k3", 3, {_x:100 + (Math.random() * 100), _y:150}), -4, 3, 18));
} else if (N == 3) {
p.all_items.push(add_falling(p.woda_mc.attachMovie("s_kaczka", "k1", 1, {_x:300 + (Math.random() * 100), _y:180, _xscale:-100}), 4, 3, 18));
p.all_items.push(add_falling(p.niebo_mc.attachMovie("s_sloneczko", "k2", 2, {_x:50, _y:40}), 4, 3, 20));
p.all_items.push(add_falling(p.lad_mc.attachMovie("s_kwiatek", "k3", 3, {_x:350, _y:150}), -3, 2, 15));
p.all_items.push(add_falling(p.niebo_mc.attachMovie("s_chmura", "k4", 4, {_x:150, _y:50}), -3, 3, 15));
} else if (N == 4) {
p.all_items.push(add_falling(p.woda_mc.attachMovie("s_kaczka", "k1", 1, {_x:50, _y:190, _xscale:-100}), 3, 3, 15));
p.all_items.push(add_falling(p.niebo_mc.attachMovie("s_sloneczko", "k2", 2, {_x:250, _y:50}), 2, 3, 17));
p.all_items.push(add_falling(p.lad_mc.attachMovie("s_kwiatek", "k3", 3, {_x:350, _y:150}), -3, 3, 15));
p.all_items.push(add_falling(p.niebo_mc.attachMovie("s_chmura", "k4", 4, {_x:50, _y:50}), 5, 4, 20));
p.all_items.push(add_falling(p.woda_mc.attachMovie("s_kaczka", "k5", 5, {_x:430, _y:180}), -4, 4, 24));
} else if (N == 5) {
p.all_items.push(add_falling(p.woda_mc.attachMovie("s_kaczka", "k1", 1, {_x:50, _y:190, _xscale:-100}), 4, 4, 22));
p.all_items.push(add_falling(p.niebo_mc.attachMovie("s_sloneczko", "k2", 2, {_x:250, _y:50}), 3, 4, 17));
p.all_items.push(add_falling(p.lad_mc.attachMovie("s_kwiatek", "k3", 3, {_x:350, _y:150}), -4, 3, 15));
p.all_items.push(add_falling(p.niebo_mc.attachMovie("s_chmura", "k4", 4, {_x:50, _y:50}), 5, 4, 20));
p.all_items.push(add_falling(p.woda_mc.attachMovie("s_kaczka", "k5", 5, {_x:430, _y:180}), -5, 4, 24));
p.all_items.push(add_falling(p.lad_mc.attachMovie("s_kwiatek", "k6", 6, {_x:50, _y:170}), 5, 4, 25));
}
}
function display_BulletsNum() {
moves_txt.text = _root.lang_arr.strz_bullets_num + p.strzalow;
}
function add_falling(MC, SPX, SPY, Z) {
MC.zakres = Z;
MC.cz = 0;
MC.dir = 1;
MC.onEnterFrame = function () {
this._x = this._x + SPX;
if (SPX > 0) {
if ((this._x - (this._width / 2)) > p.right_mc._x) {
this._x = p.left_mc._x - (this._width / 2);
}
} else if ((this._x + (this._width / 2)) < p.left_mc._x) {
this._x = p.right_mc._x + (this._width / 2);
}
if (this.cz > this.zakres) {
this.dir = -1;
} else if (this.cz < 0) {
this.dir = 1;
}
var _local2 = SPY * this.dir;
this.cz = this.cz + _local2;
this._y = this._y + _local2;
};
return(MC);
}
function steering(MC, G, SP, SL, W, H) {
var _local1 = MC;
_local1.przysp = 0;
_local1.pion = 0;
_local1.poziom = 0;
_local1.skrecanie = 0;
_local1.grawit = G;
_local1.spup = SP;
_local1.slowing = SL;
_local1.wiaterek = 0;
_local1.polsz = W;
_local1.polw = H;
_local1.can_shot = true;
}
function celownik_move(MC, RAND) {
if (Key.isDown(38)) {
MC.przysp = 2;
} else if (Key.isDown(40)) {
MC.przysp = 1;
} else {
MC.przysp = 0;
}
if (Key.isDown(39)) {
MC.skrecanie = 1;
} else if (Key.isDown(37)) {
MC.skrecanie = 2;
} else {
MC.skrecanie = 0;
}
if (MC.skrecanie == 1) {
MC.poziom = MC.poziom + MC.spup;
} else if (MC.skrecanie == 2) {
MC.poziom = MC.poziom - MC.spup;
} else if (MC.skrecanie == 0) {
MC.poziom = MC.poziom * MC.slowing;
}
if (MC.przysp == 1) {
MC.pion = MC.pion + MC.spup;
} else if (MC.przysp == 2) {
MC.pion = MC.pion - MC.spup;
} else if (MC.przysp == 0) {
MC.pion = MC.pion * MC.slowing;
}
if (RAND) {
var _local2 = 5;
MC._x = MC._x + (_local2 - (Math.random() * (_local2 * 2)));
MC._y = MC._y + (_local2 - (Math.random() * (_local2 * 2)));
}
MC.pion = MC.pion + MC.grawit;
MC.poziom = MC.poziom + MC.wiaterek;
MC._x = MC._x + MC.poziom;
if ((MC._x + MC.polsz) > p.right_mc._x) {
MC._x = p.right_mc._x - MC.polsz;
MC.poziom = 0;
} else if ((MC._x - MC.polsz) < p.left_mc._x) {
MC._x = p.left_mc._x + MC.polsz;
MC.poziom = 0;
}
MC._y = MC._y + MC.pion;
if ((MC._y + MC.polw) > p.down_mc._y) {
MC._y = p.down_mc._y - MC.polw;
MC.pion = 0;
} else if ((MC._y - MC.polw) < p.up_mc._y) {
MC._y = p.up_mc._y + MC.polw;
MC.pion = 0;
}
}
function grawitacja() {
grawit = grawit + dodatnikGrawit;
}
function lodziarnia_begin(LI) {
p = this.attachMovie("lodziarnia", "cont_mc", 1);
centruj(p, 580);
var _local7 = new Array("", {g:2, z:5}, {g:3, z:8}, {g:4, z:10}, {g:5, z:12}, {g:6, z:16});
p.ic = new Array();
var _local3 = 0;
while (_local3 < 15) {
p.ic.push(_local3 + 1);
_local3++;
}
p.ices = _local7[LI];
p.galki = new Array();
p.wybrane_galki = new Array();
p.can_play = false;
p.time_mc._visible = false;
p.timeCurrent = 0;
p.timeBegin = 0;
p.timeMax = timeMaxArray[LI] * 1000;
select_body(p.zwierz_mc);
var lyzka = p.attachMovie("lyzka", "lyzka", 10);
lyzka.startDrag(true);
lyzka._visible = false;
_local3 = 1;
while (_local3 <= 16) {
var _local2 = p[("b" + _local3) + "_btn"];
var _local6 = p[("l" + _local3) + "_mc"];
if (_local3 <= p.ices.z) {
_local6._visible = true;
_local2._visible = true;
_local2.onRelease = function () {
if (p.can_play) {
var _local3 = this._name;
var _local2;
if (_local3.length == 6) {
_local2 = _local3.substr(1, 1);
} else {
_local2 = _local3.substr(1, 2);
}
trace("l\u00F3d nr:" + _local2);
add_main_ice(int(_local2));
}
};
_local2.onReleaseOutside = function () {
lyzka._visible = false;
Mouse.show();
};
_local2.onRollOver = function () {
lyzka._visible = true;
Mouse.hide();
};
_local2.onRollOut = function () {
lyzka._visible = false;
Mouse.show();
};
} else {
_local6._visible = false;
_local2._visible = false;
}
_local3++;
}
}
function add_main_ice(N) {
if (_root.musicOK) {
_root.lody1_snd.start(0, 1);
}
var _local4 = p.zwierz_mc.h1_mc.kubek_mc.lody_mc;
p.wybrane_galki.push(N);
var _local3 = p.wybrane_galki.length;
var _local2 = _local4.attachMovie("galka", "g" + _local3, _local3);
_local2._xscale = (_local2._yscale = 140);
_local2._y = ((-_local2._height) - ((_local3 - 1) * _local2._height)) + 2;
_local2._x = _local2._x - (_local2._width / 2);
_local2.gotoAndStop(N);
check_if_ice_fine();
}
function check_if_ice_fine() {
if (p.wybrane_galki.length == p.ices.g) {
var _local3 = 0;
var _local2 = 0;
while (_local2 < p.wybrane_galki.length) {
if (p.galki[_local2] == p.wybrane_galki[_local2]) {
_local3++;
}
_local2++;
}
if (_local3 == p.wybrane_galki.length) {
addMiniPoints(game_level * 10);
if (game_level >= 5) {
addMiniPoints(50);
clear_arr(false, "lodziarnia");
} else {
want_play_more();
clear_arr(true, "lodziarnia");
}
trace("DOBRE");
} else {
clearMiniPoints();
showEndScreen(_root.lang_arr.iceshop_wrong_ice, 3, reason_lost);
clear_arr(true, "lodziarnia");
}
p.can_play = false;
}
}
function random_ice(MC) {
var _local6 = MC.lody_mc;
var _local4 = new Array();
_local4 = p.ic.slice(0, p.ices.z);
var _local2 = 1;
while (_local2 <= p.ices.g) {
var _local3 = Math.ceil(Math.random() * (_local4.length - 1));
var _local1 = _local6.attachMovie("galka", "g" + _local2, _local2);
_local1._y = (-_local1._height) - ((_local2 - 1) * _local1._height);
_local1._x = (-_local1._width) / 2;
_local1.gotoAndStop(_local4[_local3]);
p.galki.push(_local4[_local3]);
_local4.splice(_local3, 1);
_local2++;
}
var _local7 = MC._parent.down_mc._y - MC._parent.up_mc._y;
var _local8 = 80;
MC._xscale = (MC._yscale = (_local8 * _local7) / MC._height);
MC._y = (MC._parent.up_mc._y + (_local7 / 2)) + (MC._height / 2);
intek = setInterval(lod_wait, 3000);
}
function lod_wait() {
p.can_play = true;
p.chmurka_mc._visible = false;
clearInterval(intek);
lod_startCounting();
trace("clearing");
}
function lod_startCounting() {
p.time_mc._visible = true;
p.timeBegin = getTimer();
p.time_mc.onEnterFrame = function () {
p.timeCurrent = Math.round(getTimer() - p.timeBegin);
if (p.timeCurrent >= p.timeMax) {
clearMiniPoints();
showEndScreen(_root.lang_arr.iceshop_time_over, 3, reason_lost);
clear_arr(true, "lodziarnia");
delete this.onEnterFrame;
}
lod_timeDisplay();
};
}
function lod_timeDisplay() {
p.time_mc.bar_mc._yscale = (p.timeCurrent * 100) / p.timeMax;
}
function strazak_begin(IL) {
p = this.attachMovie("kwiaciarnia", "cont_mc", 1);
p.water_drop = false;
p.water_num = 100;
p.items_mc.d = 0;
p.flowersFilled = 0;
water_show();
centruj(p, 580);
flower_list(IL);
p.zwierz.gotoAndStop(_root.pionek_type);
p.onEnterFrame = function () {
celuj(p.zwierz.men_mc.hand_mc);
flower_water_flow(p.water_mc);
};
p.mo = new Object();
Mouse.addListener(p.mo);
p.mo.onMouseDown = function () {
p.water_drop = true;
if (_root.musicOK) {
_root.kwiatki1_snd.start(0, 1);
}
_root.kwiatki1_snd.onSoundComplete = function () {
this.start(0, 1);
};
};
p.mo.onMouseUp = function () {
p.water_drop = false;
_root.kwiatki1_snd.stop();
};
}
function flower_water_flow(MC) {
for (var _local5 in MC) {
var _local2 = MC[_local5];
var _local3 = 0;
while (_local3 <= p.num_of_flowers) {
var _local1 = p.items_mc["k" + _local3];
if ((_local1.kw_mc.kol_mc.hitTest(_local2) && (_local2.gY < -1)) && (!_local1.alreadyFilled)) {
_local2.play();
delete _local2.onEnterFrame;
flower_water_fill(_local1);
}
_local3++;
}
}
}
function flower_water_fill(MC) {
if (MC.filled < 100) {
MC.filled = MC.filled + MC.fill_speed;
} else {
MC.filled = 100;
MC.alreadyFilled = true;
p.flowersFilled++;
flowersFilledDisplay(true);
if (_root.musicOK) {
_root.kwiatki2_snd.start(0, 1);
}
}
MC.kw_mc.woda_mc.mask_mc._yscale = MC.filled;
}
function flower_list(N) {
if (N == 1) {
flower_add(giveMeRandom(200, 40), giveMeRandom(130), 1, 0.2);
flower_add(giveMeRandom(330, 30), giveMeRandom(200), 2, 0.15);
flower_add(giveMeRandom(400, 30), giveMeRandom(160), 1, 0.2);
p.num_of_flowers = 3;
p.water_del = 0.2;
} else if (N == 2) {
flower_add(giveMeRandom(200, 40), giveMeRandom(130), 2, 0.15);
flower_add(giveMeRandom(160, 60), giveMeRandom(230), 3, 0.1);
flower_add(giveMeRandom(360, 60), giveMeRandom(170), 3, 0.1);
flower_add(giveMeRandom(440), giveMeRandom(100), 1, 0.2);
p.num_of_flowers = 4;
p.water_del = 0.15;
} else if (N == 3) {
flower_add(giveMeRandom(130, 40), giveMeRandom(130, 0), 4, 0.075, 2);
flower_add(giveMeRandom(260, 40), giveMeRandom(230, 0), 5, 0.05);
flower_add(giveMeRandom(410, 40), giveMeRandom(200, 0), 4, 0.075);
flower_add(giveMeRandom(300), giveMeRandom(130, 0), 2, 0.15);
flower_add(giveMeRandom(430), giveMeRandom(90, 30), 1, 0.2, 1);
p.num_of_flowers = 5;
p.water_del = 0.085;
} else if (N == 4) {
flower_add(giveMeRandom(130, 40), giveMeRandom(100, 0), 2, 0.15);
flower_add(giveMeRandom(280, 40), giveMeRandom(160, 0), 4, 0.075);
flower_add(giveMeRandom(430, 40), giveMeRandom(220, 0), 6, 0.025);
flower_add(giveMeRandom(130, 40), giveMeRandom(220, 0), 5, 0.05, 2);
flower_add(giveMeRandom(280, 40), giveMeRandom(100, 0), 3, 0.1, 2);
flower_add(giveMeRandom(430, 40), giveMeRandom(160, 0), 1, 0.2);
p.num_of_flowers = 6;
p.water_del = 0.045;
} else if (N == 5) {
flower_add(giveMeRandom(120, 0), giveMeRandom(120, 50), 7, 0.025, 1);
flower_add(giveMeRandom(140, 0), giveMeRandom(190, 50), 2, 0.15, 2);
flower_add(giveMeRandom(260, 0), giveMeRandom(120), 6, 0.025);
flower_add(giveMeRandom(300, 0), giveMeRandom(210), 4, 0.075, 2);
flower_add(giveMeRandom(420, 0), giveMeRandom(170, 100), 5, 0.05, 1);
flower_add(giveMeRandom(480, 0), giveMeRandom(190, 50), 2, 0.15);
p.num_of_flowers = 6;
p.water_del = 0.045;
}
flowersFilledDisplay();
}
function giveMeRandom(N, DIST) {
if ((DIST == undefined) || (DIST == null)) {
DIST = 20;
}
return(N + (Math.round(Math.random() * DIST) - (DIST / 2)));
}
function flower_add(NX, NY, K, F, M) {
var _local2 = p.items_mc.attachMovie("kwiatek", "k" + p.items_mc.d, p.items_mc.d++, {_x:NX, _y:NY});
_local2.kw_mc.gotoAndStop(K);
_local2.kw_mc.woda_mc.mask_mc._yscale = 0;
_local2.fill_speed = F;
_local2.filled = 0;
_local2.alreadyFilled = false;
var xMovementLength = (30 + Math.round(Math.random() * 20));
var yMovementLength = (15 + Math.round(Math.random() * 15));
if (M == 2) {
_local2.bx = _local2._x;
_local2.dir = 1;
_local2.speed = 1 + Math.round(Math.random() * 4);
trace((("M = 2 nzw.speed" + _local2.speed) + " nzw.dir:") + _local2.dir);
_local2.onEnterFrame = function () {
if ((this._x < (this.bx - xMovementLength)) || (this._x > (this.bx + xMovementLength))) {
this.dir = this.dir * -1;
}
this._x = this._x + (this.dir * this.speed);
};
} else if (M == 1) {
_local2.by = _local2._y;
_local2.dir = -1;
_local2.speed = 1 + Math.round(Math.random() * 2);
trace((("M = 1 nzw.speed" + _local2.speed) + " nzw.dir:") + _local2.dir);
_local2.onEnterFrame = function () {
if ((this._y < (this.by - yMovementLength)) || (this._y > (this.by + yMovementLength))) {
this.dir = this.dir * -1;
}
this._y = this._y + (this.dir * this.speed);
};
}
}
function water_show() {
var _local3 = p.zbiornik_mc;
var _local2 = _local3.mask_mc;
var _local4 = _local3.wsk_mc;
if (p.water_num <= 0) {
trace("KONIEC WODY");
clearMiniPoints();
showEndScreen(_root.lang_arr.flowers_water_over, 3, reason_lost);
_root.kwiatki1_snd.stop();
clear_arr(true, "kwiaciarnia");
_local2._yscale = 0;
} else {
_local2._yscale = p.water_num;
}
_local4._y = -_local2._height;
}
function celuj(MC) {
var _local4 = _root.get_dir(MC, MC, true);
MC._rotation = 180 + ((_local4.c * 180) / Math.PI);
if (MC._rotation < -80) {
MC._rotation = -80;
}
if (MC._rotation > -10) {
MC._rotation = -10;
}
if (p.water_drop) {
var _local5 = _local4.v / 10;
var _local3 = (Math.PI * (MC._rotation - 180)) / 180;
var _local7 = _local5 * Math.cos(_local3);
var _local6 = _local5 * Math.sin(_local3);
var _local9 = 10 * Math.cos(_local3);
var _local8 = 10 * Math.sin(_local3);
make_water(_local7, _local6, _local9, _local8);
}
}
function make_water(GX, GY, PX, PY) {
var _local2 = p.water_mc.attachMovie("water", "water" + (d++), d, {_x:40 - PX, _y:205 - PY});
_local2.gX = GX;
_local2.gY = GY;
p.water_num = p.water_num - p.water_del;
water_show();
_local2.num = d;
_local2.onEnterFrame = function () {
move_water(this);
};
}
function move_water(MC) {
MC._x = MC._x - MC.gX;
MC.gY = MC.gY - 1;
MC._y = MC._y - MC.gY;
if (MC._y > 240) {
removeMovieClip(MC);
}
if (MC._x > 560) {
removeMovieClip(MC);
}
if (MC._xscale < 300) {
MC._xscale = MC._xscale + 10;
}
if (MC._yscale < 300) {
MC._yscale = MC._yscale + 10;
}
}
function flowersFilledDisplay(B) {
if (p.flowersFilled >= p.num_of_flowers) {
addMiniPoints(game_level * Math.round(p.water_num));
_root.kwiatki1_snd.stop();
if (B) {
if (game_level >= 5) {
addMiniPoints(50);
clear_arr(false, "kwiaciarnia");
} else {
want_play_more();
clear_arr(true, "kwiaciarnia");
}
}
}
moves_txt.text = ((_root.lang_arr.flowers_watered + p.flowersFilled) + " / ") + p.num_of_flowers;
}
function parki_begin(IL) {
currentMoveNum = 0;
p = this.createEmptyMovieClip("cont_mc", 1);
can_pick_up = true;
d = 0;
var num;
if (IL == 1) {
num = 2;
} else if (IL == 2) {
num = 4;
} else if (IL == 3) {
num = 6;
} else if (IL == 4) {
num = 9;
} else if (IL == 5) {
num = 12;
}
all_count = num;
good_count = 0;
moves = new Array();
trace((("IL:" + IL) + " NUM:") + num);
movesDisplay((currentMaxMoves = maxMoves[IL]));
var a = new Array();
var i = 1;
while (i <= num) {
a.push({num:i, il:2});
i++;
}
if (num == 2) {
num1 = (num2 = num);
sc = 140;
xm = 15;
ym = 15;
} else if (num == 4) {
num1 = 2;
num2 = 4;
sc = 120;
xm = 8;
ym = 10;
} else if (num == 6) {
num1 = 3;
num2 = 4;
sc = 110;
xm = 7;
ym = 10;
} else if (num == 9) {
num1 = 3;
num2 = 6;
sc = 90;
xm = 6;
ym = 10;
} else if (num == 12) {
num1 = 4;
num2 = 6;
sc = 90;
xm = 5;
ym = 10;
}
var i = 0;
while (i < num1) {
var j = 0;
while (j < num2) {
var n = p.attachMovie("parki", "p" + (d++), d);
with (n) {
_xscale = (_yscale = sc);
_x = j * (_width + xm);
_y = i * (_height + ym);
stop();
}
var rand_num = (_root.losuj(a.length) - 1);
var res = a[rand_num];
if (res.il == 2) {
a[rand_num].il = 1;
} else if (res.il == 1) {
a.splice(rand_num, 1);
}
n.num = 1 + res.num;
n.opened = false;
n.onRelease = function () {
};
j++;
}
i++;
}
centruj(p);
var someListener = new Object();
Mouse.addListener(someListener);
someListener.onMouseUp = function () {
if (can_pick_up) {
var _local4 = 0;
while (_local4 <= (2 * num)) {
var _local3 = p["p" + _local4];
if (_local3.hitTest(_root._xmouse, _root._ymouse, true) && (!_local3.opened)) {
if (_root.musicOK) {
_root.obuwie2_snd.start(0.1, 1);
}
currentMoveNum++;
movesDisplay(currentMaxMoves - currentMoveNum);
_local3.gotoAndStop(_local3.num);
_local3.opened = true;
moves.push({nr:_local3.num, ob:_local3});
if (moves.length > 1) {
if (moves[0].nr == moves[1].nr) {
intek = setInterval(clear_arr, 100, false, "parki");
} else {
intek = setInterval(clear_arr, 1000, true, "parki");
}
can_pick_up = false;
}
if (currentMoveNum > currentMaxMoves) {
clearMiniPoints();
moves_txt.text = "";
showEndScreen(_root.lang_arr.pairs_moves_over, 3, reason_lost);
Mouse.removeListener(this);
}
}
_local4++;
}
}
};
}
function movesDisplay(N) {
moves_txt.text = _root.lang_arr.pairs_moves_left + N;
}
function pracus_begin(LEV) {
catchedFruits = 0;
catchedCurrentFruitsNum = maxCatchedFruits[LEV];
displayFruitsNum();
ia = new Array();
p = this.attachMovie("pracus", "cont_mc", 1);
intek = setInterval(make_item, 2000 - (LEV * 150), LEV);
var _local3 = p.zwierz;
var zw = _local3._width;
_local3.can_move = true;
_local3.num_of = 0;
_local3.onEnterFrame = function () {
if (this.can_move) {
_root.move_it(this._parent._xmouse, this._y, 4, this);
}
if ((this._x - (zw / 2)) < p.left_mc._x) {
this._x = p.left_mc._x + (zw / 2);
}
if ((this._x + (zw / 2)) > p.right_mc._x) {
this._x = p.right_mc._x - (zw / 2);
}
};
p.allitems_mc.d = 0;
p.allitems_mc.cy = 0;
p.allitems_mc.cx = 0;
show_items(_local3.basket_mc.items_mc, ia);
centruj(p, 590, 240);
p.odd_btn.onRelease = function () {
if (p.zwierz.can_move) {
if (ia.length > 0) {
remove_from_basket();
}
}
};
}
function displayFruitsNum() {
var _local2 = catchedCurrentFruitsNum - catchedFruits;
if (droppedFruitsNum >= droppedCurrentFruitsNum) {
clearMiniPoints();
showEndScreen(_root.lang_arr.fruits_to_much_dropped, 3, reason_lost);
clear_arr(true, "pracus");
} else if (_local2 <= 0) {
if (game_level > 5) {
addMiniPoints(50);
clear_arr(false, "pracus");
trace("PRZESZED\u0141E\u015A GR\u0118>>");
} else {
addMiniPoints((game_level * 10) + (game_level * (droppedCurrentFruitsNum - droppedFruitsNum)));
want_play_more();
clear_arr(true, "pracus");
trace("NEXT LEVEL:" + game_level);
}
}
moves_txt.text = (((((_root.lang_arr.fruits_dropped_1 + droppedFruitsNum) + "/") + droppedCurrentFruitsNum) + _root.lang_arr.fruits_dropped_2) + _local2) + ".";
}
function make_item(LEV) {
var _local3 = p.it_mc.attachMovie("jajo", "item" + (d++), d, {_x:p.items_mc._x, _y:p.items_mc._y});
var _local4 = Math.random();
if (_local4 < (LEV * 0.05)) {
_local3.item_num = 7;
} else {
_local3.item_num = _root.losuj(6);
}
_local3.gX = (Math.random() * 5) + 4;
_local3.gY = (Math.random() * 10) + 5;
_local3.rot = (Math.random() * 15) - 7.5;
_local3.num = d;
_local3.graw = 1;
_local3.item.gotoAndStop(_local3.item_num);
_local3.onEnterFrame = function () {
rzut(this);
};
}
function rzut(N) {
var _local3 = p.zwierz;
N._x = N._x - N.gX;
if (N.gY > -10) {
N.gY = N.gY - N.graw;
}
N._y = N._y - N.gY;
N._rotation = N._rotation + N.rot;
if ((N._y + (N._height / 2)) >= p.bottom_mc._y) {
if (N.item_num == 7) {
N._rotation = 0;
} else {
droppedFruitsNum++;
displayFruitsNum();
}
N._y = p.bottom_mc._y - (N._height / 2);
N.gotoAndPlay(2);
if (_root.musicOK) {
_root.warzywniak5_snd.start(0, 1);
}
delete N.onEnterFrame;
}
var _local5 = ((p.zwierz._width / 2) + p._x) + N._x;
var _local4 = ((p.zwierz._height / 2) + p._y) + N._y;
if (_local3.prost.hitTest(_local5, _local4, true)) {
if (N.item_num != 7) {
_local3.num_of++;
ia.push(N.item_num);
show_tired(_local3, _local3.num_of);
show_items(_local3.basket_mc.items_mc, ia);
if (_root.musicOK) {
_root.warzywniak4_snd.start(0.3, 1);
}
} else {
_local3.num_of = 0;
show_tired(_local3, 6);
}
delete N.onEnterFrame;
removeMovieClip(N);
}
}
function show_tired(MC, N) {
MC.gotoAndStop(N);
if (N == 6) {
trace("\tSHOW_TIRED:" + N);
MC.can_move = false;
clear_arr(true, "pracus");
intek = setInterval(show_deletedBasket, 1000);
if (_root.musicOK) {
_root.warzywniak3_snd.start(0, 1);
}
}
}
function show_deletedBasket() {
trace("KOSZYK ZNISZCZONY!!");
clearMiniPoints();
showEndScreen(_root.lang_arr.fruits_basket_broken, 3, reason_lost);
clearInterval(intek);
}
function show_items(MC, A) {
var _local1 = 1;
while (_local1 <= 5) {
var _local2 = MC[("i" + _local1) + "_mc"];
if (A[_local1 - 1] != undefined) {
_local2.gotoAndStop(A[_local1 - 1]);
_local2._visible = true;
} else {
_local2._visible = false;
}
_local1++;
}
}
function remove_from_basket() {
var _local1 = p.zwierz;
show_in_box(ia.pop());
if (_local1.num_of > 0) {
_local1.num_of--;
}
show_tired(_local1, _local1.num_of);
show_items(_local1.basket_mc.items_mc, ia);
}
function show_in_box(N) {
var _local1 = p.allitems_mc;
var _local2 = _local1.attachMovie("jajo", "j" + _local1.d, _local1.d);
_local2.item.gotoAndStop(N);
if ((_local1.d % 15) == 0) {
_local1.cy = _local1.cy + 4;
_local1.cx = -_local1.cy;
}
_local2._x = (_local1.cx = _local1.cx + 3);
_local2._y = _local1.cy;
_local1.d++;
catchedFruits++;
displayFruitsNum();
}
function select_body(M) {
var _local2 = _root.pionek_type;
M.h1_mc.gotoAndStop(_local2);
M.h2_mc.gotoAndStop(_local2);
M.body_mc.gotoAndStop(_local2);
M.czapka_mc.gotoAndStop(_local2);
M.glowa_mc.gotoAndStop(_local2);
}
function clear_arr(HI, TYPE) {
if (TYPE == "parki") {
if (HI) {
var i = 0;
while (i <= moves.length) {
var n = eval (moves[i].ob);
n.gotoAndStop(1);
n.opened = false;
i++;
}
} else {
good_count++;
if (_root.musicOK) {
_root.obuwie1_snd.start(0.1, 1);
}
}
can_pick_up = true;
moves = new Array();
if (good_count == all_count) {
if (game_level >= 5) {
addMiniPoints(50);
showEndScreen(_root.lang_arr.all_levels_ok + points, 2, reason_alllevels);
Mouse.removeListener(someListener);
} else {
addMiniPoints(((currentMaxMoves - currentMoveNum) * game_level) + (game_level * 5));
trace("POINTS:" + points);
want_play_more();
}
}
} else if (TYPE == "pracus") {
for (var name in p.it_mc) {
delete p.it_mc[name].onEnterFrame;
}
} else if (TYPE == "kwiaciarnia") {
Mouse.removeListener(p.mo);
delete p.mo.onMouseDown;
delete p.mo.onMouseUp;
p.water_drop = false;
delete p.onEnterFrame;
} else if (TYPE == "lodziarnia") {
delete p.time_mc.onEnterFrame;
} else if (TYPE == "strzelnica") {
delete p.space_mc.ship_mc.onEnterFrame;
} else if (TYPE == "salongier") {
removeMovieClip(p);
} else if (TYPE == "gokarty") {
delete p.p1_mc.onEnterFrame;
delete p.bg_mc.p2_mc.onEnterFrame;
removeMovieClip(p);
moves_txt.text = "";
} else if (TYPE == "hala") {
delete p.men_mc.onEnterFrame;
delete p.ball_mc.onEnterFrame;
removeMovieClip(p);
moves_txt.text = "";
} else if (TYPE == "muzyczny") {
removeMovieClip(p);
moves_txt.text = "";
} else if (TYPE == "quiz") {
delete p.onEnterFrame;
removeMovieClip(p);
moves_txt.text = "";
}
if (TYPE != "parki") {
if (!HI) {
showEndScreen(_root.lang_arr.all_levels_ok2 + points, 2, reason_alllevels);
}
}
clearInterval(intek);
}
function showEndScreen(S, D, _reason) {
if (_reason == undefined) {
_reason = reason_nothing;
}
trace("[showEndScreen]");
var _local3 = opis_mc;
_local3._visible = true;
_local3.gotoAndStop(3);
_local3.result_txt.text = S;
p._visible = false;
var _local4 = _root.all_mc[("p" + game_num) + "_mc"];
_local4.done_mc.gotoAndStop(D);
if ((_reason == reason_selectno) || (_reason == reason_alllevels)) {
displayStars(game_level);
} else if (_reason == reason_lost) {
displayStars(game_level - 1);
}
trace("POINTS BEFOR ADDING:" + points);
if (_reason == reason_lost) {
points = Math.round(points / 2);
}
addPointsToArray();
trace("POINTS AFTERL" + points);
_root.info_display();
_root.play_the_music(_root.plansza_snd);
}
function addPointsToArray() {
var _local3 = 0;
if (_root.specialsAlreadyDone.length > 0) {
var _local2 = 0;
while (_local2 < _root.specialsAlreadyDone.length) {
if (_root.specialsAlreadyDone[_local2].game_num == game_num) {
_local3 = _root.specialsAlreadyDone[_local2].points;
_root.specialsAlreadyDone[_local2].points = points;
} else {
_root.specialsAlreadyDone.push({game_num:game_num, points:points});
}
_local2++;
}
} else {
_root.specialsAlreadyDone.push({game_num:game_num, points:points});
}
var _local4 = _root.all_mc[("points" + game_num) + "_txt"];
_local4.text = points;
_root.add_points(-_local3);
_root.add_points(points);
}
function displayStars(_num) {
var _local3;
var _local2 = 1;
while (_local2 <= 5) {
_local3 = _root.all_mc[((("star" + game_num) + "_") + _local2) + "_mc"];
if (_local2 <= _num) {
_local3.gotoAndStop(2);
} else {
_local3.gotoAndStop(1);
}
_local2++;
}
}
function want_play_more() {
if (_root.musicOK) {
_root.yesno_snd.start(0, 1);
}
var _local3 = opis_mc;
_local3._visible = true;
_local3.gotoAndStop(2);
_local3.yesno_mc.yes_mc.onRelease = function () {
var _local2 = this._parent._parent._parent;
_local2.game_level++;
_local2.begin_game(_local2.game_num, true);
};
_local3.yesno_mc.no_mc.onRelease = function () {
showEndScreen(_root.lang_arr.user_give_up + points, 3, reason_selectno);
};
p._visible = false;
}
function addMiniPoints(N) {
points = points + N;
}
function clearMiniPoints() {
}
function centruj(MC, SX, SY) {
var _local4;
var _local3;
if (SX == undefined) {
_local4 = MC._width;
} else {
_local4 = SX;
}
if (SY == undefined) {
_local3 = MC._height;
} else {
_local3 = SY;
}
MC._x = (25 + (this._width / 2)) - (_local4 / 2);
MC._y = 290 - (_local3 / 2);
MC.xmov = MC._parent._x + MC._x;
MC.ymov = MC._parent._y + MC._y;
}
moves_txt.text = "";
var p;
var intek;
var game_level;
var d = 0;
var ksiegarnia_questions = _root.ksiegarnia_questions;
var ksiegarnia_levels_questions_nums = new Array(0, 6, 7, 8, 9, 10);
var ksiegarnia_levels_times = new Array(0, 15, 15, 10, 10, 10);
var cl;
var music_levels_addons = new Array(0, 1, 2, 3, 4, 5);
var music_levels_length = new Array(0, 4, 8, 15, 20, 30);
var keyboardSounds = new Array();
var ping_hitballs_times = new Array(0, 10, 15, 20, 25, 30);
var ping_balls_maxyspeed = new Array(0, 15, 14, 13, 12, 11);
var ping_winds = new Array(0, 0, 0, 0, 1, 2.5);
var pingpong_low = 1;
var gokarty_op_speeds = new Array(0, 5, 5.5, 6, 6.5, 7);
var gokarty_op_velocity = new Array(0, 0.1, 0.14, 0.16, 0.18, 0.2);
var space_ships = new Array(0, 30, 40, 50, 60, 70);
var space_lives = 3;
var timeMaxArray = new Array(0, 5, 7, 10, 12, 15);
var moves = new Array();
var maxMoves = new Array(0, 8, 14, 22, 32, 50);
var currentMoveNum;
var currentMaxMoves;
var can_pick_up;
var good_count;
var all_count;
var ia;
var maxCatchedFruits = new Array(0, 25, 30, 35, 40, 45);
var droppedFruitsNum = 0;
var droppedCurrentFruitsNum = 5;
var catchedCurrentFruitsNum;
var catchedFruits;
var reason_alllevels = 1;
var reason_selectno = 2;
var reason_lost = 3;
var reason_nothing = 4;
Symbol 801 MovieClip Frame 1
stop();
Symbol 843 MovieClip Frame 1
download_btn.onRelease = function () {
_root.downloadGame();
};
Symbol 847 MovieClip Frame 2
stop();
Symbol 878 MovieClip Frame 1
more_btn.onRelease = function () {
_root.moreGames();
};
Symbol 899 MovieClip Frame 1
stop();
Symbol 908 MovieClip Frame 1
stop();
Symbol 959 MovieClip Frame 1
stop();
next_btn.onRelease = function () {
this._parent.gotoAndStop(this._parent.nextFrame());
};
Symbol 959 MovieClip Frame 2
back_btn.onRelease = function () {
this._parent.gotoAndStop(this._parent.prevFrame());
};
Symbol 959 MovieClip Frame 3
next_btn.onRelease = function () {
this._parent.gotoAndStop(this._parent.nextFrame());
};
Symbol 964 MovieClip Frame 1
stop();
this.onRelease = function () {
getURL (GameOnAde.SITE_URL, "_blank");
};
Symbol 964 MovieClip Frame 2
stop();
this.onRelease = function () {
getURL (GameOnAde.SITE_URL, "_blank");
};
Symbol 973 MovieClip Frame 1
go_mc.tyl_btn.onRelease = function () {
if (_root.current_pos > 0) {
_root.pionek_go(_root.current_trow, _root.pionek_waiting_time, -1);
_visible = false;
}
};
go_mc.przod_btn.onRelease = function () {
_root.pionek_go(_root.current_trow, _root.pionek_waiting_time, 1);
_visible = false;
};
stop();
Symbol 982 MovieClip Frame 49
gotoAndPlay (1);
Symbol 982 MovieClip Frame 59
var c;
if (_root.if_double_trow) {
c = _root.current_trow / 2;
} else {
c = _root.current_trow;
}
kostka_mc.gotoAndStop(c);
Symbol 982 MovieClip Frame 64
if (_root.musicOK) {
_root.hala1_snd.start(0, 1);
}
Symbol 982 MovieClip Frame 70
if (_root.musicOK) {
_root.hala1_snd.start(0, 1);
}
Symbol 982 MovieClip Frame 74
if (_root.musicOK) {
_root.hala1_snd.start(0, 1);
}
Symbol 982 MovieClip Frame 76
_root.question_show("direction");
stop();
Symbol 1018 MovieClip Frame 1
stop();
Symbol 1139 MovieClip Frame 1
stop();
Symbol 1142 MovieClip Frame 1
stop();
Symbol 1143 MovieClip Frame 1
stop();
Symbol 1144 MovieClip Frame 1
stop();
Symbol 1145 MovieClip Frame 1
stop();
Symbol 1146 MovieClip Frame 1
stop();
Symbol 1147 MovieClip Frame 1
stop();
Symbol 1148 MovieClip Frame 1
stop();
Symbol 1151 MovieClip Frame 1
stop();
Symbol 1152 MovieClip Frame 1
stop();
Symbol 1153 MovieClip Frame 1
stop();
Symbol 1156 MovieClip Frame 1
stop();
Symbol 1157 MovieClip Frame 1
stop();
Symbol 1158 MovieClip Frame 1
stop();
Symbol 1159 MovieClip Frame 1
stop();
Symbol 1161 MovieClip Frame 1
stop();