ShowSettings callback in Flex?

I'm pretty new to bend, so forgive me if this is an obvious question.

Is there a way to open Security.showSettings (flash.system.Security) with a callback? or at least determine if it is open now or not?

My flex application is used for streaming audio and is usually controlled by javascript, so I keep it hidden for normal use (by absolutely positioning it from the page).

When I need access to the microphone, I need to make the flash settings dialog visible, which works fine, I go to it and open the dialog.

When the user closes it, I need to move it back from the screen so that they do not see that after setting the settings they do not see the empty Flex application.

thank:)

+3
source share
2 answers

Update : flex 4 solution

So, when I switched to flex 4 and started compiling my mxml with the open source mxmlc compiler, the solution below did not work because the warning does not lose focus when you are already in the settings.

As far as I could tell, I had to move to a less elegant solution, when the user had to click "OK" in the warning window every time they were done with the settings.

Here is the new code:

private function setup_smart_hide():void {
    // Call this function whenever you make the flex app visible (or add it
    // to a show_flex() function if you have such a thing set up)
    alert = Alert.show('Click "OK" to continue.', 'Thanks!', Alert.OK, null, function(e:CloseEvent):void {

        // calls the external javascript to hide the flex app
        hide_self();

    });
}

OLD: (flex 3) Got this job ...

private function setup_smart_hide():void {
    alert = Alert.show('Thanks');

    alert.addEventListener(FocusEvent.FOCUS_IN, function(event:FocusEvent):void {
            // javascript to hide the flex app
        ExternalInterface.call("SB.flex.hide");
    });
    alert.addEventListener(FocusEvent.FOCUS_OUT, function(event:FocusEvent):void {
            // javascript to show the flex app
        ExternalInterface.call("SB.flex.show");
    });

    alert.setFocus();
}

init()... (, ), focusOut , flex .

+1

- , :

var mic:Microphone = Microphone.getMicrophone();
mic.addEventListener(StatusEvent.STATUS, onMicStatus);

Flash, , , Flash " ". , StatusEvent, , flex .

( Security.showSettings), , , , , , , .

+2

Source: https://habr.com/ru/post/1738377/


All Articles