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);

This entry was posted in Actionscript 3.0 and tagged . Bookmark the permalink.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>