flash on 2009-7-22

by pasodania
♥0 | Line 26 | Modified 2009-07-22 17:37:33 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.text.TextField;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            var txt:TextField = new TextField();
            txt.width = 300;
            txt.height = 300;
            
            // Sort Array
            var rankArr:Array = [
                {id:"田中", score:50},
                {id:"山本", score:97},
                {id:"木田", score:100},
                {id:"鈴木", score:69}    
            ];
            
            rankArr.sortOn("score", Array.NUMERIC);
            rankArr.reverse();
            
            var rank:int = 1;
            for( var line in rankArr){
                txt.text += rank.toString() + ":" + rankArr[line]["id"];
                txt.text += "/score:" + rankArr[line]["score"] + "\n";
                rank++;
            }
            
            addChild(txt);
        }
    }
}