A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Freeing variables

  1. #1
    Junior Member
    Join Date
    Nov 2004
    Posts
    7

    Freeing variables

    How do I force KoolMoves to free and reassign a variable? For example. I have a guestbook. A user posts a new entry (which is sent to MySQL as a record). When the user goes back to the guest book, I want them to see their entry. I have verified that the entry goes into MySQL, and here is what I do to try to get a new guestbook list:

    guestbooktext = ""; // trying to clear this dynamic text variable
    this.loadVariables("getentries.php","POST"); // creates the guestbooktext.txt file (this works)
    loadVariables("guestbooktext.txt", "_root"); // attempt to reload the guestbooktext variable.

    However, it does not work instantly...it takes a few minutes for the new file to be created...

  2. #2
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    Most likely freeing the variable won't help you. I guess the problem in this case is that your browser caches the txt file.

    A solution could be to request a different url each time.
    code:
    now = new Date();
    filename = 'guestbooktext.txt?' + now.getTime();
    loadVariables(filename, "_root");


    Another way could be to use sendAndLoad() to post and retrieve at the same time and only use php files. If you make sure your php file sends the proper no cache headers that should also work.

  3. #3
    Junior Member
    Join Date
    Nov 2004
    Posts
    7

    Thank you, w.brants

    The code you provided worked like a charm...it was a caching problem.

    Tony

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