Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flash and PHP problem

Status
Not open for further replies.

shaddow

Programmer
Mar 22, 2001
1,862
RO
I have an flash and i want that every time a user clicks a button something on the server updates.
My problem is that it works on first click but never again.

i have
frmData = new LoadVars();
replyData = new LoadVars();

and at each on(release) i have
frmData.cmd = "mytext";
frmData.rnd=random(99);
frmData.sendAndLoad("addpoints.php",replyData,"post")

I tryed other comands like loadVariablesNum() and frmData.send() but all works only 1 time but i want that they work every time.


________
George, M
 
should the final line not be

frmData.sendAndLoad("addpoints.php",frmData,"post")
 
i'll give a try but like i sayed it works first time (on first button) but not second time (on second button)
also i dont need the information that sendAndLoad return
I dont understand why this line
loadVariablesNum ("addpoints.php", 0, "POST");
it doesnt execute the php file at all but the line
frmData.sendAndLoad
works only 1 time in the whole movie.

________
George, M
 
I think you need to reinitialise the LoadVars objects for each button press - I assume that you're sending different data each time. Something like this on each button:

Code:
on(release){
   myRandomNumber=Math.round(Math.random()*99);
   sendDataFunction('myText',myRandomNumber);
}

calling this on the main timeline:

Code:
sendDataFunction = function (cmd, num) {
  frmData = new LoadVars();
  replyData = new LoadVars();
  frmData.cmd = cmd;
  frmData.rnd = num;
  frmData.sendAndLoad("addpoints.php", replyData, "post");
};
 
ty for the reply, i finally managed to make this working using both advice(random number and frmData.sendAndLoad("addpoints.php",frmData,"post"))
also 1 more problem that after first click i forgot to place the code on other frames on(release) event.

________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top