hi,
i have a problem using the nonoba api with flash develop and flixel. i want to integreat the highscore system(as3) in a class which do not extend sprite of movieclip. is this maybe the problem? does the function init works in as3? here is my code:
public dynamic class SubmitScore extends FlxState
{
[Embed(source = "../../data/cursor.png")] private var ImgCursor:Class;
//private var _container:MovieClip;
public function SubmitScore()
{
addEventListener(Event.ADDED_TO_STAGE, init);
FlxG.setCursor(ImgCursor);
}
private function init(e:Event):void
{
//_container = new MovieClip();
//this.stage.addChild(_container);
var scorenumber:Number = FlxG.score;
NonobaAPI.SubmitScore(stage, "nhighscore", scorenumber, getresponds);
//flash.ui.Mouse.show();
}
private function getresponds(response:String){
switch(response){
case NonobaAPI.SUCCESS:{
trace("The score was submitted successfully")
break;
}
case NonobaAPI.NOT_LOGGED_IN:{
trace("The user is not logged in")
break;
}
case NonobaAPI.ERROR:{
trace("An error occurred.")
break;
}
}
}
}
angrypiano said
a long time ago | Post #1i have a problem using the nonoba api with flash develop and flixel. i want to integreat the highscore system(as3) in a class which do not extend sprite of movieclip. is this maybe the problem? does the function init works in as3? here is my code:
package com.Game
{
import com.adamatomic.flixel.*;
import flash.display.Stage;
import Nonoba.api.NonobaAPI;
import flash.events.*;
import flash.ui.MouseCursor;
import flash.ui.Mouse;
public dynamic class SubmitScore extends FlxState
{
[Embed(source = "../../data/cursor.png")] private var ImgCursor:Class;
//private var _container:MovieClip;
public function SubmitScore()
{
addEventListener(Event.ADDED_TO_STAGE, init);
FlxG.setCursor(ImgCursor);
}
private function init(e:Event):void
{
//_container = new MovieClip();
//this.stage.addChild(_container);
var scorenumber:Number = FlxG.score;
NonobaAPI.SubmitScore(stage, "nhighscore", scorenumber, getresponds);
//flash.ui.Mouse.show();
}
private function getresponds(response:String){
switch(response){
case NonobaAPI.SUCCESS:{
trace("The score was submitted successfully")
break;
}
case NonobaAPI.NOT_LOGGED_IN:{
trace("The user is not logged in")
break;
}
case NonobaAPI.ERROR:{
trace("An error occurred.")
break;
}
}
}
}
}
thanks!