flash on 2010-4-30

by 9re
♥0 | Line 32 | Modified 2010-04-30 12:36:40 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.net.FileReference;
    import com.bit101.components.PushButton;
    import flash.text.TextField;
    import flash.events.Event;
    public class FlashTest extends Sprite {
    		public var fr:FileReference;
    	
        public function FlashTest() {
            // write as3 code here..
            fr = new FileReference;
            
            var tf:TextField;
            new PushButton(this, 365 >> 1, 445 >> 1, "browse", function ():void {
            		fr.browse();
            });
            tf = new TextField;
            tf.multiline = true;
            addChild(tf);
            XML.prettyPrinting = false;
            fr.addEventListener(Event.SELECT, function ():void {
            		tf.appendText(<>
            			name : {
            				fr.name
            			}, type : {
            				fr.type
            			}
            		</>);
            		tf.width = tf.textWidth + 4;
            		tf.height = tf.textWidth + 4;
            });
        }
    }
}