We have answer of your question!

100% solved queries, no empty question

Question: event.target.content.loaderInfo gives error if I am accessing image from external domain(SecurityErr


0

I am working on OSMF based player. I Have added logo image on top right corner of my player. Now I want to open a Link on click of logo image.

I have writen a Action script code in onMain click event

CODE:

private function onMainClick(event:MouseEvent):void{

if(event.target.hasOwnProperty("content"))

                {

                    var info:LoaderInfo = event.target.content.loaderInfo;

                    var imageUrl:String = configuration.LogoImage;//Logo url to display on player

                    imageUrl = imageUrl.split("/").splice(1).join("/");

                     if(info.url.search(imageUrl) >= 0)
                     {

                        var url:String = configuration.LogoLink;//Logo link to open in new tab

                        var request:URLRequest = new URLRequest(url);

                        try

                        {

                            navigateToURL(request, '_blank');

                        }

                        catch(error:Error)

                        {

                            trace("Error occurred!");

                        }

                    }

                }

}

When I am giving the Logo url from same domain it's working fine(given url will open in new tab). Problem occure when I am accessing the image from external domain. A domain which dosen't supporting request from my domain.

More information: Logo image is displayed properly on top right corner of my player. On clcik of logo url I am getting below error. I am providing the logo url from my config file

SecurityError: Error #2123: Security sandbox violation: Loader.content: http:///release/XYZPlayer.swf cannot access http://www.esnipe.com/shared/help_icon.gif. No policy files granted access.

at flash.display::Loader/get content()

at StrobeMediaPlayback/onMainClick()

Please can any one help me to come out of this error.

Question author Venkey | Source

Answer


1


There isn't http://www.esnipe.com/crossdomain.xml file that grants the access to the loaded content.

There is workaround for accessing loaded image bitmapData (Loading Profile Images on VK.com in ActionScript) but looking on your code you just need to remember the url of loaded image. Try to store it somewhere, for example in local variable or extend the flash Loader by your custom loader class and store the last loaded URLRequest object in it.

Example:

public class LoaderExt extends Loader
{
    private var _request:URLRequest;

    public function get url():String{return _request ? _request.url : null}

    public function LoaderExt()
    {
        super();
    }

    override public function load(request:URLRequest, context:LoaderContext=null):void
    {
        _request = request;

        super.load(request, context);
    }
}
Answer author Fsbmain

Tickanswer.com is providing the only single recommended solution of the question event.target.content.loaderInfo gives error if I am accessing image from external domain(SecurityErr under the categories i.e actionscript-3 , osmf , . Our team of experts filter the best solution for you.

Related Search Queries:


You may also add your answer

Thanks for contributing an answer to Tick Answer!