Sometimes you don't have access to the stage object due to security
restrictions, and you get an error like this:

  SecurityError: Error #2070: Security sandbox violation: caller
http://example.com/foo.swf cannot access Stage owned by
http://other.com/bar.swf.

This happens when you're loaded in a different security domain than
the loading application (which happens when you're loaded from a
different site like other.com).

Now, how do you check if you have access to the stage object? I've
written a function that does this check, but it's kind of lame (as you
can see), so I was wondering if someone has a smarter way of doing
this.

    private static function checkStageAccess():void
    {
        try {
            var dummy:Number = stage.frameRate;

            // If the above passed, we have access.
            haveStageAccess = true;

        } catch (e:SecurityError) {
            haveStageAccess = false;
        }

        stageAccessChecked = true;
    }

Manish

Reply via email to