Lib.fscommand() triggers a security error on Flash Player

Lib.fscommand() seems to trigger a security error on Flash Player target. I want to use Lib.fscommand("trapallkeys", "true"); so to block the default Flash Player keyboard shortcuts.

Also using keyboard listeners doesn’t work since the keyboard shortcuts take priority & “trapallkeys” is the only way to go about this.

Normally in Flash CS, I’d choose in the Project Settings if I wanted the script access to be local only or network and then use fscommand() only with External and StandAlone Flash Player types using the following code:

if (Capabilities.playerType == "StandAlone" || Capabilities.playerType == "External") {
    	Lib.fscommand("showmenu",    "false");
    	Lib.fscommand("trapallkeys", "true");

Is there a way to add that kind of directive in the project?

After some tinkering, I found I can add <haxeflag name="-D network-sandbox" if="flash" /> in my project.xml and seems that works fine :slight_smile:

1 Like