Use a Shared Object in a game to store pairs player_name - player

If I want to use a Shared Object in a game for a local
computer to store
pairs player_name - player_score (a string and a number) what
would be the
best approach to push the data in and retrieve them out as a
table?
Flash Help says that the properties created in a SO can
enumerated in a
for..in loop - how do I use this?

thank a lot
"clbeech" <[email protected]>
ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ
× ÎÏ×ÏÓÔÑÈ
ÓÌÅÄÕÀÝÅÅ:
news:fvsrst$qkp$[email protected]..
> I usually use an array and objects to store the pair or
more stats, then
store
> the array in the SO. it goes something like this:
>
>
> var so = SharedObject.getLocal('mygame', '/');
> var scores = [ ];
> for(var i=0; 1<10; i++) {
> var obj = {n:' ', s:o};
> scores.push(obj);
> }
>
> function updateScores() {
> if(so.data.highscores == undefined) {
> so.data.highscores = scores;
> }else{
> scores = so.data.highscores;
> }
> }
>
> function saveScore() {
> var obj = {n:name_ti.text, sc:playerScore}
> scores.push(obj);
> scores.sortOn('s', Array.NUMERIC | Array.DESCENDING);
> if(scores.length>10) scores.pop();
>
> so.data.highscores = scores;
> so.flush();
> setScoreboard();
> }
>
> function setScoreboard() {
> updateScores();
> scores.sortOn('s', Array.NUMERIC | Array.DESCENDING);
> for(var i=1; i<scores.length+1; i++) {
> this['name_'+i].text = scores
.n;
> this['score_'+i].text = scores.s;
> }
> }
>
> setScoreboard(); //initialize the board
>
> save_btn.onPress = function() {
> saveScore(); //save the score input
> }
>

Similar Messages

  • How can i use the shared object already present in the system from java.

    explanation:
    Actually there are shared objects present in the jdk which is used by java itself.I want to know if i can use the methods in any library file(shared object) which is already present in the system.
    Or the question can be put this way how does the java call the native methods? (Can we do that explicitly) in our code.

    It isn't entirely clear what you mean by 'shared' objects and what the relationship with these shared objects and calling native code is.
    There are no shared objects in the Java language, only the java platform.
    The platform system properties are exposed via the System class (java.lang package).
    You are free to create your own shared objects by using static member access or some other mechanism.
    Your access to methods in any of the API's is dictated by the access type you have, normally public being the only completely open access allowing complete visibility.
    You can call native methods, thats what JNI is for. Calling native methods in classes other than your own is generally done using the API provided by the developer(s) of those classes.

  • Using flash shared object to have a load animation play only once

    Hey all I have a swf on multiple pages, I onyl want it to
    play the load animation once, so I thought I would try the shared
    object to do this.
    //On frame 1 on my mc if it hasnt played the file below it
    should to gotoAndPlay frame 1 of my mc, logo_mc
    logoload = SharedObject.getLocal("logoload1");
    if (logoload.data.logoloadvar == undefined){
    _root.logo_mc.gotoAndStop(30);
    } else {
    _root.logo_mc.gotoAndPlay(1);
    stop();
    //at the end of my load animation frame 30 of logo_mc I am
    trying to tell the shared object that its has played, so I put
    something in it:
    stop();
    computer = System.capabilities.os;
    _root.logoload.data.logoloadvar = "logoseen";
    _root.logoload.flush();
    But it does not appear to be responding, what am I doing
    wrong there? Its the first time Ive used the object.
    Any help would be great.

    Wow. That is exactly what it was, thanks so much. Our IT guys are working on the problem now. Thanks again.

  • Shared Objects and IOS 5.0+

    So, I need a straight answer. Can I use Shared Objects for my game, or will apple fail me for using them?  Will Shared Objects be backed up with iCloud?
    Thanks,
    diss.

    Boat,
    From what I have found if your IPA/APK/SWF is the same name then shared objects data should retain.
    So if version 1 of your app was
    AppleApp.ipa published from a swf by the name of AppleApp.swf
    then when you update on your final publish save your swf and .ipa under the same name
    Dont do this
    First version is
    AppleAppV1.swf published out to AppleApp.ipa
    Second version is AppleAppV2.swf published out to AppleApp.ipa
    The swf is what the shared object is associated with so keep that the same from update to update.

  • 9 shared objects performance question

    I have 9 shared objects 8 of which contain dynamic data which i cannot really consolidate into a single shared object because the shared object often has to be cleared.....my question is what performance issues will I exsperience with this number of shared objects .....I maybe wrong in thinking that 9 shared objects is alot.....anybody with any exsperience using multiple shared objects plz respond.

    I've used many more than 9 SO's in an application without issue. I suppose what it really comes down to is how many clients are connected to those SO's and how often each one is being updated.

  • ST22 Dumps: Shared Objects

    Hi SDN,
    in our SRM System, SRM Server 5.5, WAS700 ABAP, we get ST22 Short Dumps concerning "shared objects".
    This is the Dump Short Analysis:
    Runtime Errors         SYSTEM_NO_SHM_MEMORY                                    
    Date and Time          19.08.2008 12:20:50                                                                               
    Short text                                                                    
         No more memory for 2516576 bytes in the shared objects memory.                                                                               
    What happened?                                                                
         The shared objects memory is full or an area management specified         
         memory limit has be reached.                                              
    In heard, that "shared objects" is part of the new WAS 620, 640, 2004s, 700 ... releases
    What are exactly these shared objects. And how can we avoid the dumps?
    We have an instance profile parameter set:
    abap/shared_objects_size_MB                 100
    Apparently this is not enough... Are there any recommendations?
    thanx, matthias

    Take a look at [Note 972757 - Occurence of the SYSTEM_NO_SHM_MEMORY runtime error|https://service.sap.com/sap/support/notes/972757] for further information. You should investigate what is using the shared objects memory, it may be an error in a application. The note will help to determine this.
    Regards,
    Nelis

  • Shared Object data not saving?

    I tried adding a "save progress" function to my latest project using the shared object class, yet it's not working. All of the information that should be saved, traces as undefined. I looked through some older projects, and the save functions in those projects are working fine. Any ideas on what might be the issue?

    use:
    import flash.net.SharedObject;
    var saveTest:SharedObject=SharedObject.getLocal("testFile","/");
    saveTest.data.sample="testing"
    trace (saveTest.data.sample)
    and no, you cannot explicitly control where the sharedobject is saved.

  • Flex2 and shared objects

    Hello all
    We have made a cool FLEX application (which also in on Flex
    showcase) and it works like a charm with Firefox, while in IE it
    will go down in flames with an IE-exception after some minutes of
    active use.
    And we cannot find the error. We have a suspicion that this
    is related to our use of shared objects.
    The application displays financial charts, and the values are
    stored in the cache as a shared object, so it will display faster
    the next time. This works perfect with Firefox and in IE not.
    Please try this out:
    Radar Lite
    In IE, you break it by switching stocks in the grid control,
    this will trigger a get on new chartvalues that will be stored in
    shared objects
    I have been googling like crazy to find a solution of this
    problem, without success. Has anyone here heard of a problem
    similar to this. We could really need some help here.
    Thanks in advance.
    Lars

    Hi there
    I am facing the same problem , My problem is "I have
    developed a rss reader ,the App is running fine and getting refresh
    in Mozilla but the it is not getting refresh in IE . "
    I am trying to solve this problem from last 3 days but cant
    get it right ,
    I need some advice and also some sort of help of i can get
    from any one .
    thanks
    vivek manchanda

  • ABAP Shared Objects - External Reference

    Hi,
    I am using ABAP SHared Objects (SHMA and SHMM) as data persistence between 2 BSP Applications
    I want to create a generic Root class with one attribute that is TYPE REF TO OBJECT. The idea is to store any class instance in this attribute of the Root class so as to AVOID creating a seperate Shared AREA for each Class...
    WHen I try to put this generic Root Class in the shared area via detach_commit(), it gives a exception that there are External references in the Shared area which should be closed first
    Does this mean u cannot have a instance variable as an attribute in your ROOT Class.
    Thanks
    SAP User

    Hi,
    Go through the below code, it's working fine....
    *& Report  Z13708_ABAPOBJECTS_INHER
    REPORT  Z13708_ABAPOBJECTS_INHER.
          CLASS C1 DEFINITION
    CLASS C1 DEFINITION.
      PUBLIC SECTION.
        data: var1 type ref to object.
        METHODS: METH1.
    ENDCLASS.                    "C1 DEFINITION
          CLASS C1 IMPLEMENTATION
    CLASS C1 IMPLEMENTATION.
      METHOD METH1.
        WRITE: / 'This is a method one'.
      ENDMETHOD.                                                "METH1
    ENDCLASS.                    "C1 IMPLEMENTATION
          CLASS C2 DEFINITION
    CLASS C2 DEFINITION.
      PUBLIC SECTION.
        METHODS: METH2.
    ENDCLASS.                    "C2 DEFINITION
          CLASS C2 IMPLEMENTATION
    CLASS C2 IMPLEMENTATION.
      METHOD METH2.
        WRITE: / 'This is a method two'.
      ENDMETHOD.                                                "METH2
    ENDCLASS.                    "C2 IMPLEMENTATION
    START-OF-SELECTION.
      DATA REF1 TYPE REF TO C1.
      DATA REF2 TYPE REF TO C2.
      CREATE OBJECT REF2.
      ref1->var1 ?= ref2.
    Regards,
    Azaz Ali.

  • Large shared objects

    Hi,
    we think about using ABAP shared objects in parallel processing to avoid reading the same data from the DB for every parallel process.
    Currently we have 15MB shared memory configured according to SHMM.
    My Questions:
    1. How do we extend the shared memory? What is the limit?
    2. Does anyone have experience with large shared objects? (1-2GB)
    Thanks in advance
    regards
    Steffen

    Hi Steffen,
    the parameter is abap/shared_objects_size_MB, the limit is defined by your available memory.
    I have seen sizes with 8 GB in production so far.
    Regarding the big shared objects: Carefully think about who is reading and writing and when
    these actions happen. With versioning you can easily have a much higher memory consumption
    since update requests will create a new version while readers attached to the old version
    keep the old version alive. Besides that i haven't seen much trouble with shared objects so far,
    but maybe other people have other experiences.
    Please share your experients with us if you use the shared objects.
    Kind regards,
    Hermann

  • LOCAL SHARED OBJECT in CAIRNGORM

    Hi,
    I am new to Cairngorm framework.
    I want to use Local shared object in Cairngorm framework,I am confused where i have to create and where i will get data and how i can add to lso.
    If any example or suggestions  to use Local shared object It is helpful for me.
    Thanks in Advance.
    Regards
    Naresh

    Hi,
    I am also new to flex.
    But here is what I think.
    You may want put it into servicelocator since sharedobject is not part of you cilent datamodel.
    Use delegate to update your modellocator with value from sharedobject.
    Hope it can help.
    If you solved the problem, pls also post it and we can learn together:)
    Best

  • Shared Object quirk

    Hi all,
    I made a slot machine. It's simple enough: hit the spin
    button, the reel movieclips play, and a random number is created to
    decide what the winner is. People will win hats, shirts, buffet
    vouchers, etc., and I have to limit the quantities for each, and I
    have to be able to report how many of each were spun after the
    event is done. For this, I've created a local shared object that
    stores each individual spin and also totals for each prize. I used
    the shared object so we can shut the machine down and move it to
    other parts of the city as we move around...and because it's a
    standalone machine with no VMWare or database access.
    The problem: I want to use another movie (which accesses the
    same shared object) to display the data in report format. If I
    spin, and then close the movie, and open the other one, there's
    nothing. What I have to do is spin and close the movie three times
    before there is anything showing up in the other movie. The problem
    is that I have several prizes unaccounted for.
    I'm thinking that either I start the local shared object in
    the wrong place, or am flushing it in the wrong place. Any advice
    would be greatly appreciated.
    Code is attached.

    Hi again,
    If someone can point me in the right direction as to where to
    look, I would greatly appreciate your help...Thanks!
    <pre>
    //start up the local shared object
    mySO=SharedObject.getLocal("spins","/");
    if(mySO.data.spinCount==null){
    mySO.data.spinCount="Spin Results";
    if(mySO.data.prizeTotals==null){
    mySO.data.prizeTotals="Prizes Used";
    mySO.flush();
    //done starting up the local shared object
    //Store data locally
    function sendDataToLocal(spinResult){
    mySO=SharedObject.getLocal("spins","/");
    inputOut=spinResult;
    theTime = new Date();
    spinTime= (theTime.getYear()+1900)+" .
    "+(theTime.getMonth()+1)+" . "+theTime.getDate()+",
    "+theTime.getHours()+":"+theTime.getMinutes();
    mySO.data.spinCount+="\n"+spinTime+":
    "+inputOut+"\n----------------------";
    mytempPrize=prize1+" Used= "+used1+"\n"+prize2+" Used=
    "+used2+"\n"+prize3+" Used= "+used3+"\n"+prize4+" Used=
    "+used4+"\n"+prize5+" Used= "+used5+"\n"+prize6+" Used=
    "+used6+"\n"+prize7+" Used= "+used7+"\n"+prize8+" Used=
    "+used8+"\n"+prize9+" Used= "+used9+"\n"+prize10+" Used=
    "+used10+"\nTotal Spins:
    "+(used1+used2+used3+used4+used5+used6+used7+used8+used9+used10)+"\n";
    mySO.data.prizeTotals=mytempPrize;
    trace(mytempPrize);
    mySO.flush();
    inputOut="";
    //Done storing data locally
    </pre>

  • Shared Object - Prompt Data Permissions Dialog

    Hello,
    I'm creating a small app to run from CD-Rom/local
    installation that will use multiple shared objects for data
    storage. To ensure proper saving without surprising the user with a
    permissions dialog unexpectedly, I'd like to request unlimited data
    storage on first time app launch - Joey Lott shows how to do this
    in the Actionscript Cookbook...
    request=mySO.flush(1024 * 500);
    My question is,
    Can I perform this permissions request with the user a single
    time with a generic app SO in global fashion, so that the
    permissions would be set for any SOs created during the use of the
    product (all written to same SO directory), or do I have to request
    permissions for each and every SO created? Since the latter
    would be unacceptable from a UE standpoint, that means stuffing all
    app data into a single SO which doesn't seem so great from a data
    config perspective...
    I really appreciate your attention and help on this!
    Thanks in advance,
    -Maura

    Hmm. Experimented a bit and it seems that once the permission
    is set it applies to the Flash Player installation globally, and
    not per SO, not even per domain...
    Or, please correct me if I'm mistaken.
    Thanks.

  • Using Shared Object Libraries

    How (or what) do we set when using shared object libraries?
    We have Java Native Methods which are implemented using C++ and stored in shared object libraries. We can build our project, but when trying to execute the project, the shared object libraries are not found. We had tried to set the external execution settings to include the library paths, but nothing seems to take affect.
    What do we need to set to run with the shared object libraries?

    RK,
    I appreciate your responce, hopefully we'll get this worked out. I will try to give you as much information as I can so you will hopefully understand the problem.
    We have added a Library Reference to our project - which is a jar file - this jar file contains our Business Objects which are implemented in Java. Within this Library Reference, there is a Java class which has a Native method. The method is implemented in C++ The C++ implementation of this method is within a C++ shared object library (libname.so).
    How do we let Creator know that we need to link in this C++ Shared Object Library at run time?
    The Modifers Properties for the method in the library reference are correctly set - that is they are set to Native. For a method within a java element, selecting or un-selecting this modifier simply changes the method declaration. It does not tell Creator where the actual implementation is (shared object library in this case).
    As originally stated, we tried to include our shared object library in the Execution Property of the properties window for the Java Element. Here is what we have done so far - all unsuccessful....
    Under the External Execution Property - we added the environment variable LD_LIBRARY_PATH set to our shared object library path. We also selected the Append Environment Variable (set to true). We are not able to modify the Library Path of the External Execution Property - it will not allow changes - all buttons are disabled in the pop up window.
    There are no properties for the Internal Execution within the Executor Properties, so there is nothing we can set there.
    We have tried to set the Debugger Execution properties in the same manner as the External Execution properties to run the project in Debug mode - and have the same problem - while executing the project, we get the error message which indicates that our shared object library can not be found.
    There are no property settings available on the J2EE Server Execution Properties to set.
    What do we need to set so that this Shared Object Library will be located during execution of our project under SJSC?
    Thank you for any suggestions you may have.
    --Scott                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Shared object symbols, ( I'm used to VC++ )

    Hi,
    I'm realy new at programming for linux in c++. But I'm not a noobe in C++. I'm used to MS VS.
    I tried to create shared objects with SunStudio12 and I'm was wandering if there is no "_declspec" for linux.
    The second thing is, it seams that nearly every class und function is exported. I opened the compiled so file with an editor an I saw symbols of all my classes and functions. Is there a way to reduce unwanted symbols?
    Thanks
    Martin

    ok, i understand. If I want to remove them I have to use an extra tool.
    But it make for me no sense, why are they still there. I exported ("__symbolic" ) online one funktion for all other functions an objects I set "-xldscope=hidden". Why are they still in there. Nobady can use these informations like
    9W&#65533;P        &#65533;=&#65533;]4&#65533;&#65533;;)&#65533;7       &#65533;NameSpace::Class1 &#65533;i&#65533;&#65533;T&#65533;&#65533;&#65533;&#1096;Ó^Th
           &#1311;)%&#65533;9&#65533;P"&#65533;k&#65533;&#65533;&#612;p       &#65533;&#65533;qL&#65533;<3&#65533;
    9W&#65533;P       NameSpace::Class2 const NameSpace::Class3<NameSpace::Class1>*  &#65533;&#65533;&#65533;
    &#65533;&#65533;&#65533;&#65533;&#65533;        &#65533;       &#65533;&#65533;&#65533;0O|CKA&#65533;^&#65533;+&#65533;*      NameSpace::Class3<NameSpace::Class1>*
         &#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;                &#65533;&#65533;&#65533;0O|CKA&#65533;^&#65533;+&#65533;*       &#65533;i&#65533;&#65533;T&#65533;&#65533;&#65533;&#1096;Ó^Th
           &#1311;)%&#65533;9&#65533;P"&#65533;k&#65533;&#65533;&#612;p       &#65533;&#65533;qL&#65533;<3&#65533;or should not be able to use it !
    Martin

Maybe you are looking for

  • BlackBerry Travel no longer posting Trip Details to Exchange Outlook Calendar

    I have two users (BES) who use BlackBerry Travel quite often.  I verified this by looking at their calendars and by actually logging to to Outlook as them (since I am the admin). Prior to the problem every trip had details.  In other words, if you ha

  • LV 8.2.1 reinstallation error 1301: Cannot create file

    Hi, I was forced to uninstall LV 8.2.1 and reinstall it. When I'm reinstalling LV 8.2.1 I get an error message Error 1301. Cannot create file ". A directory with the same name already exists. Cancel the install and try installing to a different locat

  • CMAP Balance issue

    Dear Team, When we are trying to do challan mapping we are facing an issue with balance amount. Eventhough we mapped first challam amount complitedly, (when we added new challan if amount is not sufficient for next period ), still the first challan i

  • Why does Labview allow a cursor in a indicator?

    Hello,     Why does Labview allow the user to position the cursor with the mouse inside a numeric indicator? Users think that just because they can put a cursor they should be able to type something and enter data. Is there a way to disable/stop the

  • Error: cannot resolve dependencies for "avahi"

    Greetings: I get the following message when I run paman -Syu :: Replace mkinitrd with mkinitcpio from "current"? [Y/n] error: cannot resolve dependencies for "avahi": "dbus" is not in the package set So, I thougth I'd get rid of avahi, but pacman -R