0 Replies Latest reply on Mar 26, 2008 8:22 AM by gaffafoote

    Illusive Security Panel in Flex

      I am trying to allow my app access to the users microphone. I'm doing this by displaying the security panel to the user entitling them to allow or deny the swf access to the hardware. (Security.showSettings("2");)

      I have put the following code into Flash IDE and published a swf which works fine (the security panel displays). When I have the identical code in Flex and call the code from my main app file (.mxml file) the published swf seems to run the security.showsettings line of code and automatically denies access to the hardware without displaying the dialog box.

      The code is below. (Apolgies for the lack of formatted code - there is no option to drop formatted code into this forum - go Adobe!)

      package soundRecorder{

      public class UserMicrophone {
      import flash.events.*;
      import flash.media.Microphone;
      import flash.system.Security;
      import flash.system.SecurityPanel;

      private var userMic:Microphone;

      public function UserMicrophone():void{

      var userMic:Microphone = Microphone.getMicrophone();

      if(userMic != null){
      userMic.addEventListener(ActivityEvent.ACTIVITY, this.activityHandler);
      userMic.addEventListener(StatusEvent.STATUS, this.onMicStatus);

      private function onMicStatus(event:StatusEvent):void {
      if (event.code == "Microphone.Unmuted"){
      trace("Microphone access was allowed.");
      else if (event.code == "Microphone.Muted"){
      trace("Microphone access was denied.");

      private function activityHandler(event:ActivityEvent):void {

      trace("activityHandler: " + event);