is it possible to find the x and y screen coordinates of letter in a text field there is a way to do this in director, i am trying to get a movieclip to proceed letters as they are typed, creating a flashing input style cursor similar to most editing text editors, i am using a dynamic field and not an input text box and lose the systems version of the cursor
basically it is a typing simulator, the user can tap away onthe keyboard hitting any key and ala actionscript it appears on the screen. the text that appears on the screen is placed one letter at a time (after each key down) and read from an external text file which naturally contains coherent copy. i am trying to keep a flashing cursor in front of the last letter of text typed at all times, the type of field prohibits this cursor so i made one as a movieclip i just need to move it along with the keystrokes
Use the | character. Just use a variable to hold the current text. Then use a loop with setInterval to show a | and then get rid of it on the next loop. This should be pretty close to the effect. If you need help with this or do not understand, I can help you in about an hour and a half. Sorry if my post seems rushed, I'm running late...
Try this code, just fill out the info in the Settings section: //:Settings: filepath = 'myfile.txt'; simfield = _root.tbox; blinkRate = 250; //:Load file: lv = new LoadVars(); lv.onData = function(raw){ alltext = raw; } lv.load(filepath); //:Simulate: c = 0; simtext = ''; listen = new Object(); listen.onKeyDown = function(){ if(alltext!=undefined){ simtext += alltext.charAt(c++); } } Key.addListener(listen); //:Update TextField: t = 0; setInterval(updateIt,10); function updateIt(){ if(t){ simfield.text = simtext+'|'; }else{ simfield.text = simtext; } updateAfterEvent(); } //:Blink Effect: setInterval(blinkIt,blinkRate); function blinkIt(){ t = (t+1) % 2 }
thanks again for the code, I actully got it working, with only one problem , when the file runs it leaves a trail of the flashing character, that does not get erased as you advance through the file, any thoughts?
Don't see what you're looking for? Try a search.
|