Be a Supporter!

[as2][ngapi] Medals.. Kind Of Work?

  • 351 Views
  • 0 Replies
New Topic Respond to this Topic
PhantomCat
PhantomCat
  • Member since: Jul. 3, 2012
  • Offline.
Forum Stats
Member
Level 20
Game Developer
[as2][ngapi] Medals.. Kind Of Work? Jul. 12th, 2012 @ 04:53 AM Reply

So far I have my API connecting properly, the pop-up set up and the medal made, all that jazz. When I run

import com.newgrounds.*;
API.unlockMedal("Test");

I get the pop-up saying the medal is unlocked, and it shows the right icon, even outside of NewGrounds. In fact, when I have it running in the Flash IDE and just test it with the debug mode off, it'll actually unlock locally. However, when I simulate a logged-in user I always get

[Newgrounds API] :: Unlocking medal "Test"...
[Newgrounds API] :: Failed to unlock "Test"!

and the same thing when I run it on NG in my project preview area. It still gets the medal's name right and still shows the right icon, it connects fine and everything.

After I added a listener for the onMedalUnlocked event, I get

[Newgrounds API] :: Unlocking medal "Test"...
You unlocked 'undefined'! (value: undefined points)
[Newgrounds API] :: Failed to unlock "Test"!

and that trace is coming from within an "if (event.success)"