Actionscript 3: Check if flash is stand alone or in browser

Here is a quick code snippet if you want to have links trace the value locally but link out in the browser.


if (Capabilities.playerType == "StandAlone" || Capabilities.playerType == "External") {
	trace("data.CTAOpen.@url : " + data.CTAOpen.@url );
} else {
	navigateToURL(new URLRequest(data.CTAOpen.@url), "_self");
}

Or you can use RegExp

var isStandAlone:Boolean = new RegExp("file://").test(loaderInfo.url);

[ad#Google Adsense]

Author: mark

Creative technologist

Leave a Reply

Your email address will not be published. Required fields are marked *