?
Solved

LoadVars issue

Posted on 2005-04-28
6
Medium Priority
?
437 Views
Last Modified: 2012-05-05
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.
0
Comment
Question by:thendrich
  • 3
  • 2
6 Comments
 
LVL 37

Expert Comment

by:CyanBlue
ID: 13890431
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
0
 
LVL 16

Expert Comment

by:sam85281
ID: 13890908
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
0
 

Author Comment

by:thendrich
ID: 13895429
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.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 37

Accepted Solution

by:
CyanBlue earned 2000 total points
ID: 13895495
Howdy...  :)

Did you try that in the web browser or within the Flash authoring environment???

As for refreshing... Maybe you should delete the instance everytime???

FILEPATH = "http://www.domain.com/some.aspx";
delete sendPack;
delete recvPack;
sendPack = new LoadVars();
sendPack.tmp = (new Date()).getTime();
recvPack = new LoadVars();
recvPack.onLoad = function ()
{
     // do your script...
}
sendPack.sendAndLoad("FILEPATH", recvPack, "POST");
0
 

Author Comment

by:thendrich
ID: 13897506
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.
0
 
LVL 37

Expert Comment

by:CyanBlue
ID: 13898208
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
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses
Course of the Month14 days, 15 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question