wonderfl fmt

by codeonwort
What happend to Wonderfl text editor? When I paste code written at another editor here there are many blank lines

- remove empty lines
- convert 4 spaces to 1 tap
♥0 | Line 46 | Modified 2012-12-29 16:26:29 | MIT License
play

ActionScript3 source code

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

package {
    
    import flash.events.Event
    import flash.display.Sprite
    import flash.text.TextField
    import flash.system.System
    
    public class FlashTest extends Sprite {
        
        private var txt:TextField
        private var msg:TextField
        
        public function FlashTest() {
            // write as3 code here..
            txt = new TextField
            txt.border = true
            txt.borderColor = 0xff0000
            txt.multiline = true
            txt.width = txt.height = 425
            txt.type = "input"
            txt.x = txt.y = 20
            addChild(txt)
            
            msg = new TextField
            msg.background = true
            msg.backgroundColor = 0xffff00
            msg.autoSize = "left"
            msg.text = "copy to clipboard"
            msg.selectable = false
            msg.x = 10
            var msg_container:Sprite = new Sprite
            msg_container.addChild(msg)
            addChild(msg_container)
            msg_container.addEventListener("mouseDown", copyToClipboard)
        }
        
        private function copyToClipboard(evt:Event):void {
            var str:String = txt.text
            var sep:String = String.fromCharCode(13)
            var ary:Array = str.split(sep)
            var dst:Array = []
            
            for each(var e:String in ary){
                if(e.length != 0){
                    dst.push(e)
                }
            }
            str = dst.join("\n")
            
            str = str.replace(/    /g, "\t");
            
            txt.text = str
            System.setClipboard(str)
        }
        
    }
    
}