Skip to main content
Participant
July 17, 2009
Question

URLLoader cannot load external text data in firefox, NEED HELP!

  • July 17, 2009
  • 1 reply
  • 668 views

I use flex builder to compile a single class to load an text data from the same domain.it works perfect in IE browser.But something is wrong with the firefox browser.take a look at the following code:

package {
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.external.ExternalInterface;
    import flash.net.URLLoader;
    import flash.net.URLLoaderDataFormat;
    import flash.net.URLRequest;


    public class test extends Sprite
    {   
        private var _urlstr:String;
        private var _loader:URLLoader;
        private var _urlreq:URLRequest;
       
        public function test()
        {   
            if(!root.loaderInfo.parameters.filename || !root.loaderInfo.parameters.url)
                return;
           this._urlstr="http://www.mysite.com/sendback.php";
            this._loader = new URLLoader();
            this._urlreq = new URLRequest();
            this.loadText();
        }
        private function loadText():void{
        this._loader.dataFormat = URLLoaderDataFormat.TEXT;
        this._loader.addEventListener(Event.COMPLETE,onComplete);
        this._urlreq.url = this._urlstr;
        this._loader.load(this._urlreq);
        }
        private function onComplete(e:Event):void{
            var txtdata:String;
            txtdata = URLLoader(e.target).data;
            ExternalInterface.call("alert",txtdata);
        }
        }
}

i compile the code above under Flex builder and use the following HTML snippet to load the test.swf file:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
            id="test" width="50%" height="50%"
            codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
            <param name="movie" value="test.swf" />
            <param name="quality" value="high" />
            <param name="bgcolor" value="#869ca7" />
            <param name="allowScriptAccess" value="always" />

            <embed src="test.swf" quality="high" bgcolor="#869ca7"
                width="50%" height="50%" name="test" align="middle"
                play="true"
                loop="false"
                quality="high"
                allowScriptAccess="always"
                type="application/x-shockwave-flash"
                pluginspage="http://www.adobe.com/go/getflashplayer">
        </embed>
    </object>

it works in IE, but not in firefox!could anyone help me out, i m just about to get crazy!

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
July 17, 2009

if that's a cross-domain php file, you'll need a cross-domain security file.  if it's not cross-domain use a local path.

Participant
July 17, 2009

they are in the same domain.i said that i have already tested it successfully on IE browser, it didn't work on firefox.thanks for your reply, but it is not what i want!

HELP ME!