Best way to determine Flash context in AS3?
-
26-10-2019 - |
Question
I want to know, if my Flashapplication is running in a browser or it is tested from within Flash authoring tool (local Flashplayer).
I came up with this one.
var isLocal:Boolean = !ExternalInterface.available || ExternalInterface.call("window.location.toString") == null;
Other than stated in the AS3 documentation ExternalInterface.available returns always true when running in a browser or testing locally.
Solution
Try using Capabilities.playerType
, it will return the type of runtime environment.
Link to the documentation here:
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow