forked from: text

by bradsedito
...
@author lizhi
♥0 | Line 50 | Modified 2011-06-24 19:42:19 | MIT License
play

ActionScript3 source code

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

// forked from lizhi's text
package  
{
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Sprite;
    import flash.display.StageQuality;
    import flash.geom.Point;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;
    /**
     * ...
     * @author lizhi
     */
    public class TestE extends Sprite
    {
        
        public function TestE() 
        {
            var tf:TextField = new TextField();
            var tfm:TextFormat = new TextFormat("Arial", 32);
            tf.defaultTextFormat = tfm;
            tf.text = "BRAD\nSEDITO";
            tf.autoSize = TextFieldAutoSize.LEFT;
            
            var bmd:BitmapData = new BitmapData(tf.width, tf.height, false, 0xffffff);
            bmd.draw(tf);
            var w:int = tf.width;
            var h:int = tf.height;
            var ps:Array = [];
            graphics.lineStyle(0);
            
            var s:int = 6;
            for (var x:int = 0; x < bmd.width;x++ ) {
                for (var y:int = 0; y < bmd.height;y++ ) {
                    if (bmd.getPixel(x,y)!=0xffffff) {
                        if (bmd.getPixel(x+1,y)==0xffffff||bmd.getPixel(x-1,y)==0xffffff||bmd.getPixel(x,y+1)==0xffffff||bmd.getPixel(x,y-1)==0xffffff) {
                            graphics.drawCircle(x*s, y*s, s);
                            if (ps[x] == null) ps[x] = [];
                            ps[x][y] = {flag:false};
                        }
                    }
                }
            }
            var paths:Array = [];
            for (x = 0; x < w;x++ ) {
                for (y = 0; y < h;y++ ) {
                    if(ps[x]&&ps[x][y]){
                        var obj:Object = ps[x][y];
                        if (!obj.flag) {
                            
                        }
                    }
                }
            }
        }
    }
}