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!

waiting until script finishes

Status
Not open for further replies.

dingleberry

Programmer
Dec 13, 2002
143
US
Hi, I've got a movie where there are two buttons on one layer. One button (the one I'm writing about in this post.) The top button submits form data to a perl script that I wrote that checks for availability of a domain name. If that domain name is available, it returns a "yes" and if it's not available it returns a "no". At any rate, the bottom text field is dynamic and if teh perl script returns a yes it also writes a variable to the text document on my server. The bottom dynamic text field then does a

loadVariablesNum (" 0);

to get that variable from the text document that was just written to. Long story short, is there any way to tell flash to wait until the perl script is done running before running any more action script that is affiliated to that same button?

Thanks,
dan
 
Hey Bill,

Thanks again for your immediate resonse. You're tips are an invaluable resource to me. That aside, I'm not sure this will work and this is why.

One button has two actions that run when it is released
1. Posts variable to my perl script using geturl with post. This script checks the posted varible to see it it's a valid domain name. If it is, it writes to the text document on my server something like this

domain_name=gravytrain.com

The second action is loadvarsnum which looks at that text doc and loads into a text field (which resides on the same frame as the button) that domain name if one exists in that text doc. Even if it doesn't exist, it's fine because it will simply load nothing if the text doc isn't written to. What's happening is it checks availability. Then immediately runs loadvarsnum (I think at the same time it's running geturl to check availability.) What that does is grabs the last domain name that was written to the text doc. Not the current one. I'm trying to make Loadvarsnum wait until the geturl is done posting. But a frameloop wouldn't help (at least how I understand it) because both actions are on the same frame and applied to the same button. Can I do a

geturl ( 0, post

while (whois.pl is running)
{
repeat something
}

loadvarsnum(
and if so, what would be the syntax for (whois.pl is running)?

Does this make sense?

thanks,
dan
 
nope....may just be me after a difficult day but it makes little sense.

tell me what i have misunderstood

user enters a domain name
clicks button
goes to perl checks if valid
writes domain to text file (if valid) else blank
flash reads text file
flash reads second to last domain (this will be because flash execute one line of code after another and wont wait for the text file to update)

and you are using flash 5

now pleaase put me straight

 
Very close...

It's kind of a doozy. There are two text fields on this frame.
1. Is is the input text field named domain.
2. Is the dynamic text field named domain_name.

user enters a domain name {into domain text field}
clicks button
goes to perl checks if valid
writes domain to text file (if valid) else blank
flash reads text file

If the perl script sees domain as valid, it writes teh following to the text doc.

domain_name=$domain
where $domain is the variable entered in for the domain text field.

Pretend you were just at my site. You entered in

iloveroses.com and the perl script sees it as valid. It writes

domain_name=iloveroses.com

However before it completes writing that, load vars num is already looking at the text file and it sees that the guy who got there before you checked on

ihateroses.com

and consequently before the perl script finishes writing iloveroses.com the loadvarsnum is loading ihateroses.com into that text field labled domain_name.

All I'm tring to do is run a perl script. wait. then loadvarsnum. I don't know what to tell the movie to wait for though. It's a doozy.
 
if there is a need to save a list of domains to a text file then continue as you are but also send the domain to flash with another variable (exists, say / true/false)

then on the button
on release(){
geturl ( 0, post
exists = false;
textbox = "";
}

on main timeline

_root.onEnterFrame = function(){
if (exists){
textbox = domain;
}else{
gotoAndPlay(2)
}
}

fame 2

gotoandplay(1);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top