Hey there. If you're reading this, it is likely you are looking for an Achievements solution for AS3. **Well you've found it!**. This Achievement API offers features you'd expect from one, and it has high flexibility, allowing you to customise it to how you want to. To get started you should:
- Download the files from the Repository.
- Link the 'Achievement.swc' to your AS3 project.
- If you use Starling, extract the 'DefaultStarlingNotification.as' into your project.
import achievement.core.AchievementManager;
import achievement.notifications.*;
import achievement.storage.DefaultLocalStorage;
import achievement.core.Medal;
private var achievementManager:AchievementManager;
function myFunction()
{
achievementManager = AchievementManager.getInstance();
// Create a notifier: ( stage, theme, alignment, delay, speed )
var notifier:DefaultUnlockNotification = new DefaultUnlockNotification( stage, NotificationTheme.Dark, NotificationAlign.TOP);
// Set the notifier that appears when a Medal is unlocked.
achievementManager.notifier = new DefaultUnlockNotification();
// Set the storage for when Medals and Properties are stored.
achievementManager.storage = new DefaultLocalStorage();
// Set the function to call when a Medal is unlocked.
achievementManager.onUnlock = onUnlockMedal;
// Set to DevMode so you don't save Medals / Properties every run.
achievementManager.devMode = true;
}
function onUnlockMedal( medal:Medal ):void
{
trace( medal.name + " was just unlocked!" );
}
This will be updated soon.