PDA

View Full Version : Combo box causes events not to trigger in movieclip?


lkelly
11-07-2005, 06:52 PM
OK, I've found a strange behavior in my movie, so I created a simple flash file to demonstrate the problem. Can anyone explain what is happening and help me find a workaround?

I have a movieclip which I'm treating like a button. I want to capture if someone has pressed it, so I have some actionscript using "on(press)." I also have a combo box on the stage which has some values I'm interested in. Here's the strange part, though...

Press the movieclip "button" over and over, even without moving the mouse at all, and you get the on(press) code each time. But as soon as you click on the combo box once and pick a value, subsequent clicks on the movieclip button ONLY trigger the on(press) code if you move the mouse a little bit in between clicks. In other words, if you move the cursor back over the movieclip button and click it several times without dragging the mouse at all, it only registers the first click. At least that appears to be the case - something is keeping the on(press) event from firing each time.

Attached is a sample flash project that should show the strange behavior I'm talking about. It writes a random number into a text box each time a press is recorded, and will also do a trace to the debug window if you run it in the IDE. I'll include both Flash 8 format and FlashMX2004. If you have an idea how to resolve this, please let me know. It's killing my touchscreen app which is going to require a few combo boxes to be selected.

Thanks.

lkelly
11-08-2005, 08:53 PM
Ah, the right choice of words finally turned up the solution.

http://www.actionscript.org/forums/showthread.php3?t=56788&highlight=combo+focus+problem

Add this to the combo box:
on(focusIn) {
Selection.setFocus(null);
}

What a PITA Macromedia!