A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: focus stuck in INPUT Textfield after hitting enter multiple times

  1. #1
    Senior Member
    Join Date
    Nov 2007
    Posts
    207

    focus stuck in INPUT Textfield after hitting enter multiple times

    Ok this was just brought to my attention...I have a search input textfield on stage that searches my list component...there is no search button, instead the search is performed 1 second after the user stops typing...(this is done with a key listener)...however the input focus gets stuck in the textfield if you type something (anything) and hit the enter key multiple times...I hit it like 5-10 real quick....then I tried to click my address bar in the browser, and I am unable to type a new URL...it just continues to type in the input text field on screen...any ideas? This doesn't happen every time...but for the most part the focus gets stuck when you hit enter a few times...

    http://www.expocadvr.com/new/default.html

    let me know if you guys know anything about this...

  2. #2
    Member
    Join Date
    Dec 2002
    Location
    Lawrence, Kansas
    Posts
    53
    I dug around livedocs and some other places for a bit to no avail =/ I've had this problem before, mostly when using other flash enabled websites. I usually solve the problem by just clicking on another tab in my browser and going back to the current focus stealing one, and then it stops.

    Sorry that's not helpful, one thing that could work, but may be more a pain than it's worth, is using the focusManager.enabled property. You can set it to false with
    Code:
    focusManager.enabled = false;
    That may relinquish the control, or it may just disable tab focusing, perhaps its worth a try?

    Good Luck

  3. #3
    Senior Member
    Join Date
    Nov 2007
    Posts
    207
    I tried that...it didnt help...I have to have this fixed by Monday and the suits are freakin out!

  4. #4
    Senior Member
    Join Date
    Nov 2007
    Posts
    207
    I have tried the following...with the same results...the keyboard focus is stuck in flash...however I have been able to get the focus to change to different elements on the stage with the enter key being hit...here are the things I have tried...

    code:

    focusManager.defaultPushButton = OKButton;


    this does nothing...
    code:

    focusManager.defaultPushButtonEnabled = false;


    this does nothing also...
    code:

    var keyListener:Object = new Object();
    keyListener.onKeyUp = Delegate.create(this, keyUpHandler);

    function keyUpHandler()
    {
    if(Key.getCode() == 13)
    {
    Selection.setFocus(null);
    }
    else
    {
    .
    .
    .
    }
    }



    this takes focus away from the input text field...but I am still not able to type in the address bar...

    I also tried substituting an element on the stage for the setFocus for example...

    Selection.setFocus("printButton"); which gave focus to the print view button and upon next enter, it would execute the print function...but the focus is still stuck within the flash movie...and I still cannot type in the address bar....

    However...the only way I have found that resolves the input problem is by clicking another tab (I have been testing this in Firefox)...and then clicking back to the tab the flash app is on...now I can type in the address bar again...this is frustrating!

  5. #5
    Member
    Join Date
    Dec 2002
    Location
    Lawrence, Kansas
    Posts
    53
    Yeah, like I said I think it's a flash player problem, not a "your code" problem.

    Actually... I just tried the movie again and I can't get my text stuck anymore. I can always type in the address bar. I've spammed enter like crazy and still haven't gotten stuck...

    Fixed perhaps? I'm using firefox 2.0.0.11

  6. #6
    Senior Member
    Join Date
    Nov 2007
    Posts
    207
    nah it still does it...you just gotta type...hit enter...try to type in the address bar...if it types in the address bar...go back to the search and type some more...hit enter a few times...and you should be stuck again =/...
    What I have noticed though, is that all my competitor's flash sites have the same problem...it just may be a flash bug?

  7. #7
    Member
    Join Date
    Sep 2007
    Posts
    48
    There can be one solution of it. I tried the same thing (pressed enter a couple of times in a few seconds) and when I went to the address bar and type something it kept typing in the text field in Flash.

    However, I tried clicking somewhere else on the same page (the place where there is no flash) and then I tried to type something in the address field and it was working.

    So, my limited knowledge okey.. but I think you need to blend some javascript with your Flash. This script will simply put the current focus of the browser away from Flash and into something else.. Play with it. I'm certain this will bring some good to you.

    make a javascript function that sets focus to something else on the page (perhaps something too small or invisible) and then call that javascript function from Flash each time the 'enter' key is pressed.

    Whats say?

  8. #8
    Senior Member
    Join Date
    Nov 2007
    Posts
    207
    How will java know that the Enter key is pressed if the focus is in the Flash input text field?

  9. #9
    Member
    Join Date
    Sep 2007
    Posts
    48
    You will call the 'javaScript' (not java) from flash when the enter key is pressed.

  10. #10
    Member
    Join Date
    Sep 2007
    Posts
    48
    Like I said, write a javascript function, call it on the event of EnterKey's pressing. May be a listener.

  11. #11
    Senior Member
    Join Date
    Nov 2007
    Posts
    207
    ok i have a keylistener that initiates the search function...I can have it call the javascript function...im not too good with javascript though...so it may take me some time to come up with a javascript function that steals the focus...

  12. #12
    Senior Member
    Join Date
    Nov 2007
    Posts
    207
    what would the set focus call look like in the javascript? and also, what would I set the focus to? there is nothing else in my html other than the swf embedding...

  13. #13
    Member
    Join Date
    Sep 2007
    Posts
    48
    You can go ahead one by one..
    like simply create a text field on the page, and then set focus to it.

    I think its something like
    Code:
    document.myForm.myInputText.focus();
    if this works, try setting focus on a form (which is invisible) or a maybe a simple HTML Button. Set its size to 0x0 (with HTML style)

    Feel free to ask for any clarifications you need regarding Javascript here. I don't think your problem is one of those 'impossible to solve' problems.

    I have to have this fixed by Monday and the suits are freakin out!
    When the project deadlines are near, people get worried... this really makes the project more complicated. Take a chill pill and focus on it.

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