monvural
monvural

Reputation: 228

How can I access allowScriptAccess's value from Flash?

I am looking to read the value of the allowScriptAccess tag so that if it is set to "never", or if it isn't set that I won't attempt to make an ExternalInterface call. Using the flex framework I can use Application.application. Is there an equivalent for Flash?

Upvotes: 3

Views: 1955

Answers (3)

Travis
Travis

Reputation: 576

There is no way to access the allowScriptAccess value directly, but you can pretty easily determine whether you are able to make an ExternalInterface call simply by using a try-catch.

try
{
  ExternalInterface.call( 'document.getElementById', 'NOELEMENTBYTHISNAME' );
  allowScriptAccess = true;
}
catch( err:SecurityError )
{
  allowScriptAccess = false;
}

You can then use your allowScriptAccess to determine application control flow to avoid making any further ExternalInterface calls.

Upvotes: 2

monvural
monvural

Reputation: 228

It seems pretty well documented that accessing these parameter values is not possible from either Flex or Flash. Flashvars can be accessed as is being suggested by the previous answer, but parameter values of the object tag cannot.

Upvotes: 1

dirkgently
dirkgently

Reputation: 111298

Such information along with any query string parameter can be accessed via the flashVars property. You can access the flashVars properties. Read this for a detailed discussion. The Flash equivalent of Application.application.parameters is stage.loaderInfo.parameters.

This blog explains how you can do this in a consistent manner.

Upvotes: 0

Related Questions