# Need help with clearInterval thingie

**URL:** <https://forum.kirupa.com/t/need-help-with-clearinterval-thingie/233287>\
**Category:** Uncategorized\
**Created:** [July 22, 2007, 12:38pm UTC](https://forum.kirupa.com/t/need-help-with-clearinterval-thingie/233287 "2007-07-22T12:38:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pixeldude](https://avatars.discourse-cdn.com/v4/letter/p/57b2e6/32.png) [@pixeldude](https://forum.kirupa.com/u/pixeldude)\
**Post date:** [July 22, 2007, 12:38pm UTC](https://forum.kirupa.com/t/need-help-with-clearinterval-thingie/233287/1 "2007-07-22T12:38:25Z")

</div>

HI everyone…

Okay just a quick shoot…after being spending an hours,a day…still missing something which is I can find out…so I’m stuck up here…and really need help here…

what I want really need help is how to clear the interval after it’s read the last length of my value in array…because currently what I have it’s only read the 1st value in array and then clear the interval…as u guy’s can see in this portion code…

```auto

for(var i:Number=0;i<TextToDisplay.length;i++){
           
            trace(TextToDisplay*.substr(0,char));
//output //////////////
/*
L
Lo
Lor
Lore
Lorem
Lorem 
Lorem i
Lorem ip
Lorem ips
Lorem ipsu
Lorem ipsum
Lorem ipsum 
Lorem ipsum 
done display all text!!! --> **it's only show the 1st value in array and then clear the interval**
Lorem ipsum d
Lorem ipsum do

*/
            if(char<TextToDisplay*.length){
                char++;
            }else{
                clearInterval(intervalId);
                onFinished();
            }
        }

```

so I want the output display all the value before it’s clear the interval… I mean after the last lenght of the value…

here’s all the code.

```auto

import CountArrayValueLength;

var DisplayText:Array = ["Lorem ipsum ","Lorem ipsum dolor ","Lorem ipsum dolor sit amet"];

var objTest:CountArrayValueLength = new CountArrayValueLength(DisplayText,10);

objTest.onFinished = function(){
    trace("done display all text!!!");
} 

```

and my class file

```auto

class CountArrayValueLength{
    
    var wait:Number;
    var char:Number;
    var intervalId:Number;
    var onFinished:Function
    var TextToDisplay = new Array();
    
    function CountArrayValueLength( __TextToDisplay:Array,__ wait:Number){
        TextToDisplay = __TextToDisplay;
        wait = __wait;
        char = 1;
        init();
    }
    
    function init() {
        intervalId = setInterval(this, "displayAllText", wait);
    }

    function displayAllText(){
        for(var i:Number=0;i<TextToDisplay.length;i++){
            trace(TextToDisplay*.substr(0,char));
            if(char<TextToDisplay*.length){
                char++;
            }else{
                clearInterval(intervalId);
                onFinished();
            }
        }

    }
    
    
}

```

Hope someone will give shed some light where the hell my wrong is…u’re help are appreciated…thanks in advanced…
