[F8] Set Interval With Delegate class
Hi there.
Trying to get to grips with the Delegate class. How do I resolve the scope issue with the interval. It can't access the class's variables.
Code:
private var sliderIntervalID:Number;
private var itemIndex:Number
targetScrollbar.slider_mc.addEventListener("onPress", Delegate.create(sliderPressed));
targetScrollbar.slider_mc.addEventListener("onRelease", Delegate.create(sliderReleased));
private function sliderPressed():Void {
targetScrollBar.startDrag(//This is not the problem);
sliderIntervalID = setInterval(myInterval, 100);
}
private function sliderReleased():Void{
targetScrollBar.stopDrag();
clearInterval(sliderIntervalID);
}
private function myInterval():Void{
trace(itemIndex);
}
Thanks