A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Shared Object HELP

  1. #1
    Junior Member
    Join Date
    Jun 2007
    Posts
    20

    Shared Object HELP

    Hi,
    I've done this AS2 shared object in my flash file.
    scoreBoard_mc.names.text & scoreBoard_mc.scores.text is at frame 4 inside a MC call scoreBoard_mc.

    what i want is show another scoreboard in my 1st frame, how to do that?

    Actionscript Code:
    var score:Number = 0;

    stop();

    sharedOb = SharedObject.getLocal("highScores");

    if (sharedOb.getSize() > 0)
    {
        var nameArray:Array = sharedOb.data.nameArray;
    }
    else
    {
        var nameArray:Array = new Array();
    }
    function appendHighScore(nm:String, score:Number):Void
    {
        nameArray.push({playerName:nm, playerScore:score});
        sharedOb.data.nameArray = nameArray;
        sharedOb.flush();
    }
    function showScores():Void
    {
        nameArray.sortOn("playerScore",Array.DESCENDING | Array.NUMERIC);
        for (var x = 0; x < nameArray.length; x++)
        {
            scoreBoard_mc.names.text = scoreBoard_mc.names.text + (x + 1) + ". " + nameArray[x].playerName + "\n";
            scoreBoard_mc.scores.text = scoreBoard_mc.scores.text + nameArray[x].playerScore + "\n";
            showscorela.text = scoreBoard_mc.names.text + (x + 1) + ". " + nameArray[x].playerName + "\n";
        }
    }

  2. #2
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    is this the same problem as posted here?

    http://board.flashkit.com/board/showthread.php?t=817315

    if so..please only post things once.

    now, I guess Im a bit unclear on what it is you want done.. let take it step by step..

    you have all this code and instances on different frame?

    what SO do you want to read from? are these two seprate SO's created by the same .swf? or two different .swf's?

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