Elamurugan
Elamurugan

Reputation: 3214

Loading image from external domain in Flash AS3

I have to load XML from external domain, so my code looks like this

var loader:URLLoader = new URLLoader();
        configureListeners(loader);

        var request:URLRequest = new URLRequest("http://demo.softsolutions4u.com/ss4uplayer/modules/podcast/lib/PlayerAPI.php");
        try {
            loader.load(request);
        } catch (error:Error) {
            trace("Unable to load requested document.");
        }

        function configureListeners(dispatcher:IEventDispatcher):void {
            dispatcher.addEventListener(Event.COMPLETE, completeHandler);
            dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
         }

        function completeHandler(event:Event):void {
            var loader:URLLoader = URLLoader(event.target);
            trace("completeHandler: " + loader.data);
            datas.appendText("completeHandler: " +loader.data);
        }


        function securityErrorHandler(event:SecurityErrorEvent):void {
            trace("securityErrorHandler: " + event);
            datas.appendText("securityErrorHandler: " +event);
        }

But it throws exception at run time

securityErrorHandler: [SecurityErrorEvent type="securityError" bubbles=false cancelable=false eventPhase=2 text="Error #2048: Security sandbox violation: http://192.168.2.55/onlinemovie/Development/SS4UPlayer310310/test.swf cannot load data from http://demo.softsolutions4u.com/ss4uplayer/modules/podcast/lib/PlayerAPI.php."

Crossdomain XML file also loaded and security allodomain is in(*). Please tell me what I missed here.


its not like that. We are not going to use the flash swf file, but our 'N' no of clients going to use this swf in their server, so then in that case how could i place the crossdomain.xml. I dont know where i should put it. Please help me to fix it.

Upvotes: 0

Views: 2733

Answers (2)

VIT
VIT

Reputation: 122

Try adding this line

Security.allowInsecureDomain("demo.softsolutions4u.com");

You should be able to test the movie ONLY inside the Flash IDE or on the client server

Upvotes: 1

Sripathi Krishnan
Sripathi Krishnan

Reputation: 31528

I don't see crossdomain.xml at the location http://demo.softsolutions4u.com/crossdomain.xml, it returns a 404 error. You should place the crossdomain.xml at the root of the domain and try again.

Upvotes: 1

Related Questions