flash on 2013-4-23

by poepoemix
♥0 | Line 31 | Modified 2013-04-23 11:25:09 | MIT License
play

ActionScript3 source code

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

package {
    import flash.net.NetStream;
    import flash.events.NetStatusEvent;
    import flash.text.TextField;
    import flash.net.NetConnection;
    import flash.display.Sprite;
    import flash.external.ExternalInterface;
    import flash.media.*;
    public class FlashTest extends Sprite {
        private var tf:TextField;
        private var nc:NetConnection;
        private var ns:NetStream;
        public function FlashTest() {
            // write as3 code here..
            tf = new TextField();
            tf.width=300;
            tf.height=200;
            addChild(tf);
/*            nc = new NetConnection();
            nc.addEventListener(NetStatusEvent.NET_STATUS, function(e:NetStatusEvent):void {
                if(e.info.code == "NetConnection.Connect.Success") {
                ns = new NetStream(nc);
                ns.addEventListener(NetStatusEvent.NET_STATUS, function(ee:NetStatusEvent):void {
                    info(ee.info.code);
                });
                ns.attachCamera(camera);
                ns.publish("ttest", "live");
                info(e.info.code);
                }
            });
            nc.connect("rtmp://localhost:1935/test");*/
            var v:Video = new Video(320,240);
            v.alpha = 0;
            var camera:Camera = Camera.getCamera();
            camera.setQuality(0, 85);
            camera.setMode(320,240,15,true);
            v.attachCamera(camera);
            addChild(v);
            info(Camera.names);
        }
        public function info(data:*):void {
            tf.appendText(data.toString() + "\n");
        }
    }
}