;

PDA

Click to See Complete Forum and Search --> : loadVariables vs. getURL?


T Buck
05-10-2006, 05:56 PM
I have gotten my form in Koolmoves to interact with a php program, yet I am not able to see in the movie or receive back into the movie the variables I sent via the below statement, executed in the movie, when a button is clicked on:

on (release) {
loadVariables("bfcpassword.php","POST")
}

When I change the above loadVariables statement to
on (release) {
getURL(“bfcpassword.php”,”POST”)
}

I then am sent to the bfcpassword.php page, which displays the Koolmoves variable names & their modified values, via several php ‘print’ statements. I am using, in bfcpassword.php,

print “&txt1var=”.$txt1var;
print “&txt2var=”.$txt2var;
etc…

The variable names are the same as the variable name(s) for several dynamic text boxes within the movie, i.e. dynamic text box ‘txt1’ has its variable name set to ‘txt1var’.

The bfcpassword.php program is correctly operating on the variables sent from the movie – it is changing their values based on computations within the bfcpassword.php program.

Yet, I can not seem to get the values for the variables to ‘refresh themselves’ within the dynamic text boxes in the movie.

Am I doing something wrong in the bfcpassword.php program, by using print statements?
Or is my loadVariables statement incorrectly formatted so as to receive back to the movie the results of the computations within the bfcpassword.php program? Both the movie and the php program reside within the same directory on the server.

Thanks for any assistance.

Tom

blanius
05-10-2006, 09:54 PM
LoadVariables dosen't wait for data to return so you have to do the waiting. This is were LoadVars is a better choice as it has events like onData.

Look up the syntax and usage here. Note you must convert the examples to AS1.0 from 2.0 but that's not very hard.
http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.htm?href=Part4_ASLR2.html

indogo
05-10-2006, 10:31 PM
Try _root.loadVariables or this.loadVariables had a similar problem and this cured it.

Your code otherwise is ok and should update the varables/textfield in a static movie.
The only other drawback with this method is that all variables in the same movieclip are sent which loadVars solves.

have fun

mike

blanius
05-10-2006, 10:36 PM
If your movie is stopped I don't think the a textbox will get updated. Before LoadVars I used script timers to look for the data. That's where loadVars is great you don't have to wait for the data.

Events rock man....

blanius
05-10-2006, 10:54 PM
//Create LoadVars object
my_lv= new LoadVars();
//set the data to send

my_lv.txt1var=_root.txt1var
my_lv.txt1var=_root.txt1var

my_lv.onData = function(src) {
txt1.text = src;
};
my_lv.sendAndLoad("bfcpassword.php", my_lv, "POST");

T Buck
05-11-2006, 06:26 PM
Thanks to everyone for their help. I am new to actionscript as well as PHP. Both share similarities to a language I used eons ago - IBM PL/1.

tom

Chris_Seahorn
05-11-2006, 08:29 PM
Events rock man....

No doubt. The loadVars class is worlds away from the old method. If it's a standard GET or POST it's not such a big deal (ok...it is ;) )but almost all forms expect a response from the backend and that is where that class rocks.

blanius
05-12-2006, 12:03 PM
I remember my first email form I did with 3dfa and loadvariables. I spent a fair amount of time figuring out how to "wait" for a response before allowing the user to continue. First time I discovered I could use LoadVars in KoolMoves I was excited as it was SOoooo simple to get when the server responded.

Chris_Seahorn
05-12-2006, 12:07 PM
Yeah...I chuckle everytime I see one of my old source codes with loop code and watcher clips and such. That class made it all outdated in an instant. Gotta be one of the top five classes to learn huh?