In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

forked from: as3swf test

Get Adobe Flash player
by yonatan 27 Nov 2010
/**
 * Copyright yonatan ( http://wonderfl.net/user/yonatan )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/29ok
 */

// forked from mash's as3swf test
package {
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
    import com.codeazur.as3swf.SWF;
    import com.bit101.components.*;
    
    public class as3swfTest extends Sprite {
        private var btn:PushButton;
        private var tf:TextArea;
        private var swf:SWF;

        public function as3swfTest() {
            tf = new TextArea;
            tf.width = stage.stageWidth;
            tf.height = stage.stageHeight;
            addChild( tf );

            btn = new PushButton(stage, stage.stageWidth / 2 - 50, stage.stageHeight / 2 - 10, "Upload SWF", upload);
        }

        private function upload(e:*):void {
            var ref:FileReference = new FileReference;

            ref.addEventListener(Event.SELECT, function(e:*):void { ref.load(); });
            ref.addEventListener(Event.COMPLETE, function(e:*):void { 
					stage.removeChild(btn); 
					tf.text = new SWF(ref.data).toString(); 
				});
            ref.browse([new FileFilter("swf", "*.swf")]);
        }
    }
}