dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: URLRequest / Loader not always returning correct information

  1. #1
    Senior Member
    Join Date
    Dec 2005
    Posts
    142

    URLRequest / Loader not always returning correct information

    Ran into a rather weird issue when loading some RSS

    To give you an idea There is the defualt feed, and then the "improved feed"

    http://www.mysite.com/info.rss
    http://www.mysite.com/info.rss?watched&sortbydate

    To be clear, the "improved" feed works 100% every time you load it in your browser, or any rss program, it will always load correctly.

    HOWEVER, using the following code

    Code:
    var loader:URLLoader=new URLLoader();
    
    				loader.addEventListener(Event.COMPLETE, onRedDataLoad);
    
    			
    				loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
    				loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
    
    			
    				loader.load(new URLRequest("http://www.mysite.com/info.rss?watched&sortbydate"));
    Here is the kicker, The above code is ran once every 180 seconds. The first time it runs, it will ALWAYS pick up the wrong feed (it will pick up "http://www.mysite.com/info.rss" as if the items at the end are not there, after that, it will pick up the correct feed 99% of the time, while once in a blue moon, it will not pick up the correct feed (and pick up the normal version)

    does anyone have any ideas? this is driving me insane atm

  2. #2
    Senior Member
    Join Date
    Dec 2005
    Posts
    142
    (the edit button seems to be gone)

    I should note that this is in adobe air

  3. #3
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    It's possible you're getting cached results. You can usually force fresh data by attaching something to the url to guarantee it's unique.
    Code:
    loader.load(new URLRequest("http://www.mysite.com/info.rss?watched&sortbydate" + "&nocache=" + new Date().getTime()))
    getTime() returns the number of milliseconds since 1970 so it's guaranteed to always be different.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center