A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [F8] Multiple listeners with Delegate class

Hybrid View

  1. #1
    Senior Member
    Join Date
    Feb 2005
    Posts
    237

    [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
    Last edited by arkum; 07-09-2006 at 09:16 AM.

  2. #2
    Senior Member
    Join Date
    Feb 2005
    Posts
    237
    NeverMind. I've sorted it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center