flash on 2011-3-5

by Nek
♥0 | Line 31 | Modified 2011-03-05 08:04:52 | MIT License
play

ActionScript3 source code

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

package {
    import flash.utils.ByteArray;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            trace(hexCharToInt("0"));
        trace(hexCharToInt("1"));
        trace(hexCharToInt("2"));
        trace(hexCharToInt("3"));
        trace(hexCharToInt("4"));
        trace(hexCharToInt("5"));
        trace(hexCharToInt("6"));
        trace(hexCharToInt("7"));
        trace(hexCharToInt("8"));
        trace(hexCharToInt("9"));
        trace(hexCharToInt("A"));
        trace(hexCharToInt("B"));
        trace(hexCharToInt("C"));
        trace(hexCharToInt("D"));
        trace(hexCharToInt("E"));
        trace(hexCharToInt("F"));
            
        }
    public function hexCharToInt(char:String):uint {
        var ba:ByteArray = new ByteArray();
        ba.writeUTFBytes(char);
        var kOffset:Array = [0, 0x30, 0x37, 0x57];
        var c:uint = ba[0];
        return c - kOffset[(c >> 5) & 3];
    }

         
    }
}