A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: externalInterface and ajax, old xml loads not new

  1. #1
    Member
    Join Date
    Jan 2010
    Posts
    30

    externalInterface and ajax, old xml loads not new

    I've used ExternalInterface.call for an onclick flash event to load some xml with XMLHttpRequest. the xml loads. but if i change the xml file on the server, the old xml file loads for the client, not the new one. i believe the problem is that the browsers are caching the results. i heard that this could usually be fixed by returning false from ur JavaScript onclick handler. but i dont have a JavaScript onclick handler, i have a flash onclick handler.

  2. #2
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    add a random num to the xml file?

    myXML.load("someXML.xml?"+rand(999999));

    or something for a dirty fix..

  3. #3
    Member
    Join Date
    Jan 2010
    Posts
    30
    i only have one file though i dont have 999999 files

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    lol, yes, but don't worry, it's just some random number to trick the cache.

    gparis

  5. #5
    Member
    Join Date
    Jan 2010
    Posts
    30
    ok got it i had to put a + "?" + between the name and the random number generated

  6. #6

  7. #7
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    yeah put the '?' in ....

    Code:
    myXML.load("someXML.xml?id="+new Date().getTime());
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

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