--- In [email protected], "Jo Morano" <[EMAIL PROTECTED]>
wrote:
>
> Moving the script up to the application level didn't help. I've put
the code
> from the book which should just compile (using an app now and
moving vbox
> below):
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
width="400"
> height="300" creationComplete="createMic()">
> <mx:Script>
> <![CDATA[
> import flash.media.Microphone;
> import flash.events.ActivityEvent;
> import flash.events.Event;
> import flash.events.StatusEvent;
>
> public var mic:Microphone;// = Microphone.getMicrophone
(); // <---
It seems to me that you've commented out the part that would prevent
the error.
Here's the example from the Help:
package {
import flash.display.Sprite;
import flash.events.*;
import flash.media.Microphone;
import flash.system.Security;
import flash.system.SecurityPanel;
public class MicrophoneExample extends Sprite {
public function MicrophoneExample() {
var mic:Microphone = Microphone.getMicrophone();
Security.showSettings(SecurityPanel.MICROPHONE);
mic.setLoopBack(true);
if (mic != null) {
mic.setUseEchoSuppression(true);
mic.addEventListener(ActivityEvent.ACTIVITY,
activityHandler);
mic.addEventListener(StatusEvent.STATUS,
statusHandler);
}
}
private function activityHandler(event:ActivityEvent):void {
trace("activityHandler: " + event);
}
private function statusHandler(event:StatusEvent):void {
trace("statusHandler: " + event);
}
}
}
It looks like Microphone might be a Singleton Class and probably you
can't even refer to it without using getMicrophone() to get the
instance of it.
HTH;
Amy