Jump to content
Larry Ullman's Book Forums

Recommended Posts

I am developing a Spanish language learning app and having trouble with the text input in the upper right corner.

 

http://www.unlockspanish.com/

 

Previously the app was done in Flex, and it has tying functionality which is more enjoyable to use than the current javascript version (above link).

 

http://www.unlockspanish.com/FlexApp/

 

Notice if user types a word in FlexApp box, for example,  print

 

in dictionarry, the drop down display box continues to display other words that do not match this string.  The typing function always forwards to a word on a list, and displays adjacent words in the dropdown.

 

QUESTION:  I have the source code for the Flex App.  Can I copy the typing functionality into the Javascript app?  OR, is there another way to achieve a similar result.

 

 

All advice is greatly appreciated.

Brian Matthews

Share this post


Link to post
Share on other sites

While it makes me cringe a little, probably your best bet is to make an unordered list with all of the words, and then jump to the appropriate word when you start typing.

 

You'll want to hook up an onkeydown event handler to the text input, and then every time an event fires, compare the string in the text input to all the words in the list. As soon as you find a word that matches, you can jump to it by figuring out how far down in the list the word is, multiplying that number by the height of the li elements, and then setting the scrollTop property of the unordered list to that.

 

I know that answer may sound a bit cryptic, so ask if you need more help.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...