Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Pause in program

hi developers !

i need a pause in my program. but this does not work with

setTimeout (3000);

i want 4 images, and each of them should be visible for 1 or 2 seconds

this could not be so difficult damn :-)

— asked July 12th 2010 by Hansjuerg Wuethrich
  • iphone
  • mobile
  • settimeout
0 Comments

3 Answers

  • Checkout the setTimeout and setInterval examples in the kitchen sink. You could nest the timeout commands for a small number of images, or use setInterval with a larger number.

    This is psuedo code, but the setTimeout/Interval commands should be correct.

    setTimeout(function(){
        Show image1
        setTimeout(function(){
            Show image2
            setTimeout(function(){
                    Show image3
                    setTimeout(function(){
                        Show image4
                    },2000);
                },2000);
            },2000);
    },2000);
    
    
    picArray=["pic1", "pic2", ... "pic100"];
    picNumber=0
    var x=setInterval(function(){
        Display picArray[picNumber]
        picNumber++;
        if (picNumber > picArray.length) {
            clearInterval(x);
        }
    }, 2000)
    

    Hope this helps.

    — answered July 12th 2010 by Curtis Olson
    permalink
    0 Comments
  • create the image named let's say img1, then try this:

    setTimeout(function(){ img1.hide();}, 3000);
    
    — answered July 12th 2010 by Dan Tamas
    permalink
    0 Comments
  • Thank you guys!!

    I feel, this two answers, will guide me to the right direction !!

    Thanks for your input !

    — answered July 13th 2010 by Hansjuerg Wuethrich
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.