A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Exit an executable using a four digit string

  1. #1
    Junior Member
    Join Date
    Jul 2006
    Posts
    1

    Talking Exit an executable using a four digit string

    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

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    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?
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Junior Member
    Join Date
    Jun 2006
    Posts
    27
    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

  4. #4
    Senior Member dudeqwerty's Avatar
    Join Date
    Mar 2005
    Location
    Bosnia
    Posts
    1,626
    well if the digits are going to be entered into a textbox, say with the instance "input" then you could use the following:
    Code:
    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:
    Code:
    var count:Number = 0;
    onTouch = function(){
        count == 4 ? fscommand("quit", "") : count ++;
    };
    HTH,

    zlatan
    New sig soon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center