Perhaps your slider value is exceeding the min or max limits when you add (or subtract) xSpeed. Check for this, and subtract if the value is too high, or add if the value is too low.
Perhaps your slider value is exceeding the min or max limits when you add (or subtract) xSpeed. Check for this, and subtract if the value is too high, or add if the value is too low. // EDIT: Code modified to reflect most recent comment if(h.
Minimum h. Value) { xSpeed -= e. AccelerationX * 4; var lastSpeed:Number = xSpeed; } else if (h.
Value = h. Maximum ) { xSpeed = -2 } h. Value += xSpeed; h.
DispatchEvent(new FlexEvent("valueCommit")).
Thanks, but that doesn't quite work either. Part of the problem is that once it hits h. Minimum or h.
Maximum, it's stuck there. It doesn't move. – David Nov 17 '11 at 18:06 In the else conditions, try setting xSpeed to something other than lastSpeed.
Try xSpeed = 2 at first. Also, I just noticed a typo in my code above. The first else should only check if the value is – eterps Nov 17 '11 at 19:00 Actually, try just reversing the speed value (effectively reversing the direction of the slider) – eterps Nov 17 '11 at 19:12 Thanks.
It still sticks when it's at the left end of the track. But I may have figured out what's wrong here. I think I need to manipulate h.thumb.
X, not h.value. I'll report back if that works... – David Nov 18 '11 at 16:10 I'm wondering if lastSpeed is always winding up as a positive value, or 0. If that's the case, then the slider will get stuck at one or both ends.
Try the code above as an experiment. – eterps Nov 18 '11 at 16:23.
OK, have figured this out and wanted to share it. The key is not to mess with setting the hslider's h.value. Rather, just set the x of the thumb, and let the value take care of itself.
The accelerometer event calls a handler; in that handler create a moveThumb() function which will adjust that x. Then, from within the moveThumb() function, dispatch the valueCommit event so that the hslider will respond. Private var xSpeed:Number; private function accUpdateHandler(e:AccelerometerEvent):void { xSpeed -= e.
AccelerationX; moveThumb(); } private function moveThumb():void { var newX:Number = h.thumb. X + xSpeed; var newY:Number = h.thumb. Y + ySpeed; if (newX h.
Width - h.thumb. Width) { h.thumb. X = h.
Width - h.thumb. Width; xSpeed = 0; } else { h. Value += xSpeed; } h.
DispatchEvent(new FlexEvent("valueCommit")); }.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.