I just threw together a small flapjax demo on a whim - it
demonstrates, among some basic event/behavior examplings, that flapjax
works fine with other libraries (in this case, SoundManager2). It is
hosted at
http://users.wpi.edu/~dbjorge/flapjax/piano.html
While I was making it, I came across a problem that I was hoping
someone here could help with. I tried making the text box at the
bottom clear the input as you typed so that it could read the entire
box instead of just the last character in the box (which would let
people play chords if you pressed several keys at once), and it worked
pretty well except for one issue - extractValueB('thetextbox') doesn't
seem to pick up changes in the value if the value is set by javascript
instead of a user. I tried clearing it by putting a clear function
inside a mapE on extractValueB('thetextbox').changes() (the same place
the "playNoteSound()" bit fires), but whether I tried it - whether the
clear function worked via insertValueB('', 'thetextbox', 'value') or
document.getElementById('thetextbox').value='' - extractValueB
('thetextbox') doesn't seem to notice the value changing
programatically. This caused a bug in that extractValueB
('thetextbox').changes() wouldn't fire if the user played the same
note twice in a row, since as far as flapjax seemed to know the box
hadn't changed.
Is this behavior intended? I can see how it could potentially cause
infinite loop issues if it worked like I'd like here and programmers
weren't careful about it. If it's not intended, am I doing something
wrong, is it a bug in flapjax, or a quirk of javascript...?
Thanks!
-Dan Bjorge