• About WordPress
    • WordPress.org
    • Documentation
    • Learn WordPress
    • Support
    • Feedback
  • Log In
Skip to content

MonoFlauta

Indie Game Developer

Menu
  • Blog
  • Portfolio
    • Games
      • Happy Ghost Studio
      • Etermax
      • Silky Smooth Studio
      • Fun+Mono
    • Frameworks & Tools
      • Framework Goat
      • Twitch Mono Integration
      • Framework Mono
      • Narwhal Engine
    • Others
  • Store
  • About Me

Framework Mono – Managers/NewgroundsAPIManager.as

cropped-icono.jpgThe NewgroundsAPIManager.as script will help you as a facade of the Newgrounds API. The goal of this facade is to make things easier when using the api. Though most of them are already simple, it will simplify a few more. Note: You will need a public static instance of mono in the Main.as


How to start the NewgroundsAPIManager.as

In order to start the manager you will need first to have a public static instance of mono in the Main.as.

Once you already have it, just create an instance of the NewgroundsAPIManager.as doing something like this:

 newgroundsAPIManager = new NewgroundsAPIManager("theIdGoesHere", "theAPIEncryptGoesHere", Main.mono.mainStage);

The first parameter is the id of the project, the second is the api encrypt code and the third is a display object. The last one you can get it from Mono.as

Once you have this, you can use all the functions from it.


How to use ads

In order to add the newgrounds ad you will just need to do the following:

 newgroundsAPIManager.addAd(20, 20);

Simple call the addAd function and send by parameter the position where you want the add. Default is 0, 0.

Then, if you want to remove it, just call removeAd:

 newgroundsAPIManager.removeAd();

It will auto remove the ad you created before.


How to log a custom event

If you configured custom events and you want to log them, you will need to call the following function with the name of the event:

 newgroundsAPIManager.logCustomEvent("myCustomEvent");

How to load a custom links

If you want to load a custom link through the api you can call the following function with the url:

 newgroundsAPIManager.loadCustomLink("www.monoflauta.com");

If you configured your personal site you can use:

 newgroundsAPIManager.loadMySite();

Or load an official URL if you configured one:

 newgroundsAPIManager.loadOfficialURL();

Or just load Newgrounds:

 newgroundsAPIManager.loadNewgrounds();

How to use highscores

If you want to show the highscore table, once you have it configured, you will just need to call the following function:

 newgroundsAPIManager.showScores("ScoreBoardName", "All-Time", 20, 20);

First you will need the name of the score board. In the second parameter goes the default time period you want to show. The possible options are All-Time, This Month, This Week, This Year and Today. And finally, the last to options are the positions where you want to show it.

Then, if you want to remove it, just call:

 newgroundsAPIManager.hideScores();

It will remove the last highscore table you showed.

Then, if you want to post a score, you can call the following function:

 newgroundsAPIManager.postScore("scoreBoardName", 71);

The first parameter will be the name of the score board while the second parameter is the score you want to post to it.


How to use the medals

If you configured medals for your game. You can unlock them by doing the following:

 newgroundsAPIManager.unlockMedal("nameOfTheMedal");

By doing this you will be unlocking the medal (It will auto check you haven’t already locked the medal). Just send by parameter the name of the medal.

Also, if you need to know, you can check if a medal is already unlocked by doing the following:

 var unlocked:Boolean = newgroundsAPIManager.isMedalUnlocked("nameOfTheMedal");
 if(unlocked) trace("Is unlocked!");

In this case we are tracing “Is unlocked” if the medal is unlocked.


Public Functions

  • addAd(posX:int = 0, posY:int = 0):void
  • removeAd():void
  • logCustomEvent(event:String):void
  • loadCustomLink(link:String):void
  • loadMySite():void
  • loadOfficialURL():void
  • loadNewgrounds():void
  • showScores(scoreBoardName:String, period:String = “All-Time”, posX:int = 0, posY:int = 0):void
  • hideScores():void
  • postScore(scoreBoardName:String, score:Number):void
  • unlockMedal(medalName:String):void
  • isMedalUnlocked(medalName:String):Boolean

Private Vars

  • _id:String;
  • _encrypt:String;
  • _root:DisplayObject;
  • _flashAd:FlashAd;
  • _scoreBrowser:ScoreBrowser;

Powered by WordPress MonoFlauta 2025 | All Rights Reserved.

Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
View preferences
{title} {title} {title}