;

PDA

Click to See Complete Forum and Search --> : Exit an executable using a four digit string


PeeZee25
07-03-2006, 10:24 AM
ello peeps, I am currently completing a flash touchscreen project and have almost finished but come up against a problem that seems so simple yet I just can't get my head around it. Okay, I've created an executable that I need to close when a user enters a four digit string. The default is to exit on Esc, however, this makes it too easy for a user to be able to close the executable and then have access to the computer. I'm sure that I did a similar thing whilst a Uni (but it was oh so long ago), please help!

Thanks in advanced

cancerinform
07-03-2006, 11:20 AM
Welcome!

Since this is your first thread, please read the forum rules. Thanks. :)

http://board.flashkit.com/board/showthread.php?t=692175

I've created an executable that I need to close when a user enters a four digit string.

What do you mean by that?

shaagnik
07-07-2006, 10:31 AM
you could have a nested if...
like say the four digit string was 1 2 3 4
you could say like
if(keypressed = 1){
if(keypressed = 2){


etc.
i dunno it might be a slow way but it'dprobably work, right? as long as you redetect the keypress after each one

dudeqwerty
07-07-2006, 01:16 PM
well if the digits are going to be entered into a textbox, say with the instance "input" then you could use the following:

setInterval(function () {
if (input.length == 4) {
fscommand("quit", "");
}
}, 10);

just put the code on the frame

or

if there is no textbox, then you would set up a variable called "count" or something similar, then on your input handler you would increment the value of your variable by one.

a psudo example:


var count:Number = 0;
onTouch = function(){
count == 4 ? fscommand("quit", "") : count ++;
};


HTH,

zlatan