Maybe you can try to explain what it is you're trying to achieve, exactly, with this script.
And I hope the 2-million lines of codes was a joke...
as said, I have a ListBox with several values in it.
When clicking on one of these values, I'd like other fields to populate accordingly.
Say user selects value A from the ListBox, then a textfield will show a text referring to A.
If user selects more values from the ListBox (through Ctr, Shift or mouse dragging), then that textfield will immediately show a different text message and so on.
To let you better understand:
the easiest solution I tried was to add a mouse-up event action in the ListBox to .setFocus on a dummy field of the doc. This way I hoped, the ListBox would commit and I could use .currentValueIndices to get its selected values. However, it seems that there are no ways to make the ListBox commit unless the user clicks somewhere else on the doc.
PS: by scripting with event.shift, event.modifier and event.change I got to a good point (just about 50 lines of code actually - if you wish I can send them over to you privately). However, I can't capture mouse dragging because "event" doesn't have that property;
I found it Gilad!
For others' reference (I hope Adobe people will leave this nice hack I found today after hours of hassle - well, on the contrary, let's hope they will add a field commit() method or similar):
this is how I made my "f" field commit without user's intervention:
f.display = display.hidden;
f.display = display.visible;
as previously said, .setFocus() doesn't reach the same effect.
Maybe you Gilad or someone else have a more elegant solution? Please share it with us.