Interval

I want to clear the “message” text after of 5 sec of the url has been loaded, how do I do?

on (release, keyPress “<Enter>”) {
if (login == “test” & password == “test”) {
message = “Wait a moment…”;
getURL(“http://www.kirupa.com”, “_blank”);
interval of 5 sec
message = “”;
} else {
message = “Wrong password”;
}
}

im not 100% sure but maybe this will work

on (release, keyPress "") {
    if (login == "test" & password == "test") {
        getURL("http://www.kirupa.com", "_blank");
        pTime=getTimer();
        while(!time){
            nTime=getTimer();
            message = "Wait a moment...";
            if(nTime-pTime>5000){
                message = "";
                time=true;
            }
        }
    } else {
        message = "Wrong password";
    }
}

If that doesn’t work let me know… I know I may have to work that into a function.

Thks for the code man, but not worked so fine… when I put the log/pass, the movie stucks, and the message “Wait” doesn’t appear. After 5 sec, all fields are clear.

hey, I’ve always wondered about that… is there a setInterval command in AS?

hi,

the eassiest way is use setIntervel()
it is a new feature of MX

Regards
ajok
[email protected]

And how the setInterval() function works, in this case?

in the button

on (release, key press "") {
	if (login == "test" && password == "test") {
		message = "Wait a moment...";
		getURL("http://kirupa.com", "_blank");
		clearMessageInterval = setInterval(clearMessage, 5000);
	} else {
		message = "Wrong password";
	}
}

the function

clearMessage = function() {
	message = "";
	clearInterval(clearMessageInterval);
}

or something along those lines … :sigh: :stuck_out_tongue:

you can use setTimeout which can be found at the bottom here:
http://www.umbc.edu/interactive/flash/tutorials/setInterval.php

its setInterval that doesnt repeat (like setTimeout for javascript)
Declare the setTimeout function in the first frame of the movie then use

on (release, key press "") {
        if (login == "test" && password == "test") {
                message = "Wait a moment...";
                getURL("http://kirupa.com", "_blank");
                setTimeout(function(){message=""}, 5000);
        }else message = "Wrong password";
}

NOTE: this is pretty much what KAX’s version does (which should work dandy), just using the setTimeout version of setInterval which is nice to have for future reference in similar situations

NOTE: this is pretty much what KAX’s version does (which should work dandy), just using the setTimeout version of setInterval which is nice to have for future reference in similar situations

yup … thanks sen =) :wink: