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: Mic ans Cam Check

Get Adobe Flash player
by kingyiren 13 Mar 2011
    Embed
/**
 * Copyright kingyiren ( http://wonderfl.net/user/kingyiren )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/e8ci
 */

// forked from yooyke's Mic ans Cam Check
package {
    import flash.display.Sprite;
    import flash.media.Microphone;
    import flash.media.Camera;
    import flash.text.TextField;
    import flash.events.Event;
    
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            if (stage) init(null);
            else addEventListener(Event.ADDED_TO_STAGE, init);
        }
        
        public function init(e:Event):void {
            removeEventListener(Event.ADDED_TO_STAGE, init);
                
            var tf:TextField = new TextField();
            tf.width = stage.stageWidth;
            tf.height = stage.stageHeight;
            addChild(tf);
            
            var name:String;
            tf.appendText("Microphone\n")
            for each (name in Microphone.names) {
                tf.appendText("- " + name + "\n");
            }
                    
            tf.appendText("\nMicrophone\n")
            for each (name in Camera.names) {
                tf.appendText("- " + name + "\n");
            }
        }
    }
}