A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [F8] button release OR enter keypress

  1. #1
    Junior Member
    Join Date
    Jun 2008
    Posts
    18

    Question [F8] button release OR enter keypress

    I'm making a simplistic flash RPG, and we have included some quiz elements.
    When you enter this frame, the focus is in the dynamic text box, the user enters the correct number, and then clicks the "answerBtn".

    answerBtn.onRelease = function() {switch case here}

    But I want the option to either click the "answerBtn", or simply hit the enter button. I know the enter btn code is something like:
    on(release, keyPress "<Enter>") { codegoeshere }

    But how do I put this into an OR statement?
    Something like:
    ((answerBtn.onRelease) || (release, keyPress "<Enter>)) { codegoeshere }

    (The code it runs is on the same frame, and all actionscript is in one layer.)

    Can anyone help me out?
    Thanks in advance

  2. #2
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    This way may be pretty sloppy but once you enter the area set a new interval and delete it once either is checked!? There's really got to be a better way!

    PHP Code:
    buttonInterval setInterval(checkTextbox,100)

    function 
    checkTextbox(){
         
    answerBtn.onRelease btnFunction;
         if(
    Key.isDown(Key.ENTER)){
             
    btnFunction();
         }
    }
    function 
    btnFunction(){
      
    clearInterval(buttonInterval);
      
    //codegoeshere

    Where's DawsonK? He'll have the answer!
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

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