A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8] Highscore Frame or whatever...

  1. #1
    Member
    Join Date
    Jul 2007
    Posts
    28

    [F8] Highscore Frame or whatever...

    Ok, i have a game that i host on my school server, the teacher allowed it or whatever...But yeah, i was wondering if anyone could help me make a frame in my game once you get game over where you can submit your score and whenever anyone else gets a score lower than the top 10 highscores they just view them, rather than submit it...

    Can anyone help? And remember it can't be on the internet in anyway as it's disallowed at school :S

    Thanks,
    YM

  2. #2
    Truimagz.com everfornever's Avatar
    Join Date
    Sep 2006
    Location
    St. Louis
    Posts
    1,306
    The SharedObject class is used to read and store limited amounts of data on a user's computer. Shared objects offer real-time data sharing between objects that are persistent on the user's computer. Local shared objects are similar to browser cookies.

    Here are three possible uses of shared objects:

    A game that stores a user's high scores. The game could provide personalized data for users, such as user name and high score, without dedicating storage on the server.
    A phone book application that can work either online or offline. The phone book, delivered as a projector application, could contain a local data cache with a list of names and phone numbers entered by the user. When an Internet connection is available, the application would retrieve up-to-date information from a server. When no connection is available, the application would use the latest data saved in shared objects.
    User preferences or tracking data for a complex website, such as a record of which articles a user read on a news site. Tracking this information would allow you to display articles that have already been read differently from new, unread articles. Storing this information on the user's computer reduces server load.
    Local shared objects maintain local persistence. For example, you can call SharedObject.getLocal() to create a shared object that contains the high score in a game. Because the shared object is locally persistent, Flash saves its data attributes on the user's computer when the game is closed. The next time the game is opened, the high score from the previous session is displayed. Alternatively, you could set the shared object's properties to null before the game is closed. The next time the SWF file runs, the game opens without the previous high score.

    To create a local shared object, use the following syntax:

    Code:
    var so:SharedObject = SharedObject.getLocal("userHighScore");
    so.data.highScore = new Number();
    so.flush();

    In the example, the shared object is explicitly flushed, or written to a disk. When an application closes, shared objects are automatically flushed; however, it is shown here to demonstrate the step of writing data to a disk.

    Local disk space considerations: Local shared objects can be very useful, but they have some limitations that are important to consider as you design your application. Sometimes your SWF files may not be allowed to write local shared objects, and sometimes the data stored in local shared objects can be deleted without your knowledge. Flash Player users can manage the disk space that is available to individual domains or to all domains. When users lower the amount of disk space available, some local shared objects may be deleted. Flash Player users also have privacy controls that can prevent third-party domains (domains other than the domain in the current browser address bar) from reading or writing local shared objects.

    Note: Local content can always write third-party shared objects to disk, even if writing of shared objects to disk by third-party domains is disallowed.

    Adobe recommends that you check for failures that are related to the amount of disk space available and to user privacy controls. Perform these checks when you call getLocal() and flush():

    SharedObject.getLocal() -- This method returns null when the user has disabled third-party shared objects and the domain of your SWF file does not match the domain in the browser address bar.

    SharedObject.flush()
    -- This method returns false when the user has disabled shared objects for your domain or for all domains. It returns "pending" when additional storage space is needed and the user must interactively decide whether to allow an increase.

    If your SWF file attempts to create or modify local shared objects, make sure that your SWF file is at least 215 pixels wide and at least 138 pixels high (the minimum dimensions for displaying the dialog box that prompts users to increase their local shared object storage limit). If your SWF file is smaller than these dimensions and an increase in the storage limit is required, SharedObject.flush() fails, returning "pending" but then calling your SharedObject.onStatus handler with a result of "SharedObject.Flush.Failed".

  3. #3
    Member
    Join Date
    Jul 2007
    Posts
    28
    Wow, thanks, not sure i understand all that but i get the gist lol.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center