Groups | Blog | Home
all groups > flash actionscript > february 2005 >

flash actionscript : How to erase variables?


germaris
2/4/2005 10:35:50 PM
Hi there! I'm using Flash MX, not MX 2004. From my .swf File, I
successfully execute searches via PHP into a MySQL Database. A first search
returns a given result, if I execute another search which I am sure will return
no result, the results of the first search are displayed again! For all the
dynamic fields receiving the variables, I wrote in the 'on (press)' script of
the search button du bouton instructions like : _root.myField1.text = '';
_root.m yField2.text = ''; _root.m yField3.text = ''; How should I write my
'on (press)' ActionScript in order to 'purge' (or erase) the old variables the
variable? I also tried expressions like : variable1 = ''; variable2 = '';
variable3 = ''; but it didn't work... Many thanks in advance for your help!
:-)))
germaris
2/5/2005 12:46:10 AM
Thanks for your response. I don't think I'm doing something wrong and that I'm
not waiting long enough either. Let's work on simple examples. Let's say I
already know the results the search must return which is a good way to verify
how the search works... don't you think so? In the following examples, the
values are those which I MUST get. search A returns variable1 = 'one';
variable2 = 'two'; variable3 = 'three'; displays field1 =
'one'; field2 = 'two'; field3 = 'three'; Everything is
fine search B returns variable1 = 'four'; variable2 = 'five';
variable3 = 'six'; displays field1 = 'four'; field2 =
'five'; field3 = 'six'; Here too, everything is fine. Old variables
are replaced by new ones. search C returns variable1 = '';
variable2 = ''; variable3 = ''; displays field1 = 'four';
field2 = 'five'; field3 = 'six'; HERE IS THE PROBLEM !!! INSTEAD
OF DISPLAYING EMPTY FIELDS, THE FIELDS DISPLAY THE VALUES OF search B AGAIN !!!
If it is a cache problem, how can I solve it? Does an Update Variables
function could be built? This problem is very annoying.... Regards.
kglad
2/5/2005 1:43:40 AM
you can prevent the caching of variables by appending a number(that changes
with each call) at the end of your php call:

dataHolder.loadVariables("myscript.php?nocache="+getTimer());

i'm not so sure that's causing the problem, but it's easy enough to try.
Jeckyl
2/5/2005 10:39:16 AM
You are probably not waiting for the next lot of results to return. Or it
may be a caching issue (and old values are being returned from cache instead
of going to your server php to get new answers). Have you checked that you
are actually making different queries to your database via the php .. maybe
that is where your problem is.

But if the pup is sending back the correct answer, then your variables will
be replaced with new content.

You must be doing something else wrong other than what you're telling us.
--
All the best,
Jeckyl

AddThis Social Bookmark Button