I can see vars in a textbox, but my script does not work?
Hi,
this is a very common problem..
Loadvariables just sends a request to the server, and the movie continues to play. After some time (say a few seconds), flash will have received a response from the server.
If you are staring at one of those text fields, you just ... wait a moment
If you want to use the data in your script, you have to add some waiting to your script.
technique a - frame loop:
1st frame in row:
set _some variable you expect_ to a value that will not be sent (if you are expecting a "status" with possible values "ok" or "fail", set it to "waiting")
loadvariables
play (in case the movie was stopped and this is a button action)
2nd frame - no code
3rd frame:
if the particular variable still has the _impossible_ value, go back one frame
4th frame - data is ready for use
If your data does not contain a suitable variable for the checking, just add one.
Possible extension: use getTimer when sending to the request and in frame 3 to detect a possible timeout (server does not respond, sends a scrit error instead of data, ...)
Frames 2 and 3 can be used to show a "server busy" animation
technique b - event handler:
if you use a data movieclip (loadvars object), you can use the onclipevent(data) or the onload function. In that case code using the variables would be placed in the event function, or the event function would advance a stopped movie to the next frame
Musicman
2 Attachment(s)
You guys know stuff, please help.
Hey guys,
I kind of feel like an ass for posting a simple question in the middle of your database conversation, but I need somebody who knows flash and PHP to pinpoint my issue.
I have attached the .fla (which is loaded into my _root swf) and a txt file with my PHP script, which is based on Musicman's tutorial on emailing with PHP. I am working with PHP 4.3.5, but I have tried to use all the updated scripting that Musicman suggested.
I have obviously missed/don't understand something, because the swf will do what it's supposed to, and the script seems fine, but they don't connect to each other.
Please help and offer an explanation if you can...I really want to understand this stuff, but I'm a lot less knowledgable in PHP than with Flash.
Thanks.