I have this code that works fine with plain fields. However it doesn't work with flash textareas. Any idea why?
on mouseup me
puppetSound 1, "typewriter1"
displayfield = window("stage").movie.member(which_field)
c = displayfield.text.length
if c <> 0 then
put numtochar(32) into displayfield.char[c+1]
window("stage").movie.member(which_field).selection = [c + 1, c + 1]
It "doesn't work" because you're operating on the member, not the sprite. I have no idea why you're jumping through all the DOM hoops in your code, but try the following instead:
on mouseup me sound(1).play( member("typewriter1") ) tFocus = _movie.keyBoardFocusSprite tText = sprite(tFocus).text c = tText.length if c <> 0 then tText = tText & numtochar(32) sprite(tFocus).text = tText else beep end if end
The code does add a space at the end of a character but when I input a new character the space is deleted. Any ideas why?