In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Using Score Ranking API 1st Step

@see http://wonderfl.net/static/asdoc/score
Get Adobe Flash player
by 9re 16 Jul 2010

    Talk

    greentec at 16 Feb 2011 21:32
    why can't i save ranking?? i think it's api problem... but i don't know exactly it works. i forked this source and it doesn't work well. please help me...

    Tags

    Embed
/**
 * Copyright 9re ( http://wonderfl.net/user/9re )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/hkqj
 */

package  
{
    import com.bit101.components.Component;
    import com.bit101.components.PushButton;
    import flash.display.Sprite;
    import net.wonderfl.score.basic.BasicScoreForm;
    import net.wonderfl.score.basic.BasicScoreRecordViewer;
    /**
     * @see http://wonderfl.net/static/asdoc/score
     */
    
    import flash.text.TextField;
    public class Test extends Sprite
    {
        private var _tfStatus:TextField;
        private var _form:BasicScoreForm;
        
        public function Test() 
        {
            // set up stage : noscale, top-left align
            Component.initStage(stage);
            
            // to make the code short, define the score
            // as a random number for now.
            var score:int = 1000 * Math.random();
            
            _form = new BasicScoreForm(this, (465-BasicScoreForm.WIDTH)/2, (465-BasicScoreForm.HEIGHT)/2, score, 'SAVE SCORE', showRanking);
        }
        
        private function showRanking($didSavedScore:Boolean):void {
            _tfStatus = new TextField;
            _tfStatus.text = 'saved score : ' + $didSavedScore;
            addChild(_tfStatus);
            // removes form
            removeChild(_form);
            
            var ranking:BasicScoreRecordViewer = new BasicScoreRecordViewer(this, (465-BasicScoreRecordViewer.WIDTH)/2,(465-BasicScoreRecordViewer.HEIGHT)/2,'RANKING', 99, true);
        }
    }
}