4 Replies Latest reply on Jun 22, 2009 6:35 AM by Sreelash

    Issue with imagescroller when setinterval is used

    Sreelash Level 1

      Hi,

       

           I am working in an image scroller. Now i need to add a new feature. ie, To pause the scrolling for a specified time after each image scrolled out from the stage. But I have implemented this using a setInterval and clearInterval. But there is an issue occuring in this case. When the image pauses, a gap is occuring between the last image and first image of the scroller. Also when the scrolling continues this gap is also increasing. When the first image scrolled out, it will be again appending with the images scroller. That means it's appending after the last image of the scroller. Thus first and last images comes next to each other. When the scroller pauses, the gap is occuring between the first and last images. Anybody have idea about this.

       

      Regards,

           Sreelash.S.

        • 1. Re: Issue with imagescroller when setinterval is used
          Ned Murphy Adobe Community Professional & MVP

          If you show the code you are using, someone may be able to help.

          • 2. Re: Issue with imagescroller when setinterval is used
            Sreelash Level 1

            The code is very big. Will it be ok if i post part of the code using for scrolling and the code using for pausing the scroller.

            • 3. Re: Issue with imagescroller when setinterval is used
              Ned Murphy Adobe Community Professional & MVP

              It's preferable that you only show the code that is relevant to the problem, which would probably be whatever controls the gaps and the intervals.

              • 4. Re: Issue with imagescroller when setinterval is used
                Sreelash Level 1

                Hi,

                 

                The following function is called when all the images are loaded on the stage. After all the images are loaded the following function is invoked on an "onEnterFrame".

                 

                "duration" specifies the duration for which the scroller to be paused after an image scrolled out from the stage.

                 

                function controllScrollHor(){       
                    if(MouseOver==false&&StartScroll == true){
                        if(ScrollMode == 'LeftRight'){           
                            this._x+=ScrlConst;           
                            if(this._x> 0){               
                                ScrollMCTolleranceWidth =0;
                                SCObj = this;               
                                this._x = (-1*ScrollMCWidth);       
                                if(duration > 0){
                                    stopScrolling();  
                                }   
                             }                           
                          }else if(this._x<0){
                                ScrollMCTolleranceWidth = Math.abs(this._x);
                                SCObj = this
                    }

                }

                 

                 

                function stopScrolling(){
                    StartScroll = false;
                    intervalId = setInterval(this, "executeCallback", duration);
                }

                 

                function executeCallback(){
                    StartScroll = true;
                    clearInterval(intervalId);
                }