Link to home
Start Free TrialLog in
Avatar of thendrich
thendrich

asked on

LoadVars issue

Hello,

I have built a flash based content editor and am having an issue with loading the saved files back in.

Here are the steps my application goes through before encountering the problem:

1.  I Type text into text fields and add formatting.
2.  I then Save the text by sending it as a variable through LoadVars to a .NET script which reads the variables and saves the text as a file.
3.  I Generate a tree structure from saved files through another .NET script and then display that tree back in Flash.

This all works fine.  The problem I am haveing is after I save over a file and try and load it a second time.  If I change the text content and resave the file, I can see the tree refresh and if I look at the file itself, it has updated.  But, if I try and save the file a second time, everything works fine up until I try and reload that file.  The loadVars variable that that should contain the UPDATED text file, somehow still has the original information inside of it.  Once again, I have checked the actual text file, and everything is being saved properly.  The problem is when I am loading the file a second time.  It will not display the newest version.  

Any help would be appreciated.
Avatar of CyanBlue
CyanBlue
Flag of United States of America image

Howdy...  :)

It sounds like Flash is loading the data from the cache...
The easiest way of solving this would be adding a random number at the end...

This sample might differ depending on how you are loading the ASPX page, but you'll get the idea...

aspxFile = "http://www.domain.com/some.aspx";
data_lv = new LoadVars();
data_lv.onLoad = function ()
{
     // do your script...
}
data_lv.load(aspxFile + "?uniqueID=" + getTimer());

Let me know if it works okay or not...  ;)

CyanBlue
Avatar of sam85281
sam85281

Flash does not handle refresh well.  You need to close all your browser windows and re-open to see your changes.  I specialize in Flash CMS and wish it wasn't the case, but it is.

It's common and normal.  Just need to close them windows and re-open.

-Sam
Avatar of thendrich

ASKER

Hi again,

Thanks for the replies.  I have tried both suggetsions and am still having trouble.  This is the code I used for the random variable:

sendPack.sendAndLoad ("FILEPATH?"+random(500000)+"&"+new Date() ,recvPack,"POST");

And I tried refreshing the browser, closing it, and deleting the cache.  Nothing will allow me to load the newest version of the files after I save over them.  I was wondering if there is a way to refresh the LoadVars variables.  I don't know if this is worth trying or not.
ASKER CERTIFIED SOLUTION
Avatar of CyanBlue
CyanBlue
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Still no luck.  Tried deleting the instances and appending the random variable.  Nothing.  These solutions should work, but Flash is definately not up to par in this area.  I ended up appending a version number in the .NET side to each file so that every time I save it, a new filename is available, thus bypassing the need to reload the same file more than once.  Thanks for all the help though.  Very much appreciated.
Sorry to hear that it wasn't working for you...  and glad to hear that you were able to apply the same routine in the .NET page...  :)
Still makes me wonder WHY it wasn't working though...  :(

CyanBlue