Invite A Friend |  Contact | Help |  Sign Out   
Sign In or Register
Email: Password:
        Upload
Home Games Prizes Info









Flash ActionScript 2
Flash ActionScript 2.0  This is a simple guide on how to integrate our high scores API into a flash game using AS2. At this point we do not have an API for AS3.


OVERVIEW

TheOnlyPoints High Scores API allows you to submit scores as well as to make your game play for points. Scores reported by the statistics API will also show up in the high scores list. High scores will be visible in many places on OnlyPoints automatically, such as the game page  in chat and on the main poage under 'Latest Score', so your game does not  have to display high scores, reporting them is the most important part. The high scores API is meant to provide a simple interface for submitting and retrieving high scores, without having to set up statistics on the server beforehand.


IMPLEMENTATION
 

STEP 1
First, you will need to add a line of code that will cause your game to connect to our servers. It should be placed as early in the timeline as possible, usually on the first frame. You may copy and paste this code into your FLA or ActionScript:

_root.connection = new LocalConnection();
STEP 2

After step 1, you will have two options:

Option 1: Charge player points to play the game in order to record his\her score on the winners board. The best way to do this will be when the player clicks the "Start Game" button. You may copy and paste this code into your FLA or ActionScript:

_root.flag = 1;  // The flag=1 means that the player is playing your game for points.
_root.connection.send("onlypoints", "playpoints");

Option 2: You may have two buttons where one of them is for points, the other one can be for practice where no points are charged. The start button that charges points will have to use the code above. The "Practice Button" will use the code below:

_root.flag = 0;  //The flag=0 means that the player is playing your game for practice. No score is recorded and no points are charged.

(Instead of having one one button for practice and for points you may have an easyl mode for practice and a hard/normal for points.)


STEP 3

After that, you can start submitting scores! The submit function takes two  arguments, one is the score you wish to submit for the player and the second is the flag. It is recommended that you submit this score at the end of the game, but you can submit whenever you like.
 
_root.connection.send("onlypoints", "submitscore",_root.flag, score);


 

 

Your Account

Help & Information OnlyPoints.com
Achievements Terms and Conditions Sign Up
Orders Privacy Policy Games
My Profile FAQ Ranked Games
My Favorites Developers Multiplayer Games
Games Uploaded Link Exchange Submit Games
Points Advertising Upload Games with API
  Contact Us  


Copyright 2008  OnlyPoints.com. All rights reserved.

.