wiln / flexlib

Automatically exported from code.google.com/p/flexlib
0 stars 0 forks source link

Slider control dispatches multiple release events when only one thumb dragged. #160

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create an ExtendedSlider.
2. Set a break point in ExtendedSlider.as inside the onThumbRelease method
(line 336).
3. Compile and debug the application.
4. Drag the left thumb so that the cursor/pointer is partially above the
right thumb.
6. Release the thumb. Note the 'onThumbRelease' event fires twice - once
for each button.

What is the expected output? What do you see instead?
onThumbRelease to fire once for the thumb being dragged.  Instead,
onThumbRelease fires for the thumb being dragged and the thumb the cursor
is above when the Thumb is released.

What version of the product are you using? On what operating system?

Please provide any additional information below.
This is a bug in the Flex Framework (SDK-16808), as it also occurs with the
Slider.as class.  The issue with ExtendedSlider specifically is that,
because of this bug, the 'counter' variable does not decrement properly.

Example: If I follow the steps above, it would result in a counter variable
with a value of -1: 
1. starts at 0 (0)
2. is incremented '1' (1) when onThumbPress fires
3. is decremented '1' (0) when onThumbRelease fires
4. then, is decremented '1' (-1) again when the second onThumbRelease fires.  

So, if a developer continues to use the same instance of ExtendedSlider,
the 'change' event will not fire after the thumb is released because the
'counter' variable is never '0' at the appropriate time - it is continually
decremented to '-1'.

A workaround is to check if the counter variable is -1 at the beginning of
onThumbPress.  If it is, set it back to 0:

if(counter < 0){
   counter = 0;
}

However, a real fix appears to require changes to the Flex framework.

Original issue reported on code.google.com by nerdC...@gmail.com on 11 Sep 2008 at 6:49

GoogleCodeExporter commented 9 years ago

Original comment by dmcc...@gmail.com on 8 Jan 2009 at 5:59