Titanium Community Questions & Answer Archive

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

before blur event?

Is there any event we can listen for similar to viewWillDisapper?

blur seems to be similar to viewDidDisappear.

I'm hoping to run some animations before my window is closed.

— asked December 6th 2010 by Kim Le
  • blur
0 Comments

2 Answers

  • Kim

    You have not stated your mobile platform or Ti SDK version. An easy way of doing this is simply to add the information to your tags when you post a question.

    You may need to post some code before anyone can give you a definitive answer, but why not just place the animation code before the window's close() method?

    If you are looking for a specific Ti method to add the animation by default for all windows close events then, no, I'm afraid this is not possible.

    — answered December 6th 2010 by Paul Dowsett
    permalink
    0 Comments
  • you can create an animation and then listen for the completion of the animation so close the window you are trying to close

    var firstWindow = Titanium.UI.createWindow({
        title: "App FirstWindow"
    });
    var sayByeByeButton = Titanium.UI.createButton({
        title:'Bye Bye',
        top:110,
        width:90,
        height:35,
        borderRadius:1,
        font:{fontWeight:'bold',fontSize:14}
    });
    firstWindow.add(sayByeByeButton); 
    
    
    sayByeByeButton.addEventListener('click',function(e)
    {
        // lifted from kitchen sink....
        var t4 = Ti.UI.create2DMatrix();
        t4 = t4.rotate(-30);
        t4 = t4.scale(1.5);    
        var a2 = Titanium.UI.createAnimation();
        a2.transform = t4;
        a2.duration = 3000;
        a2.autoreverse = true
    
        a2.addEventListener('complete',function() {
            Ti.API.info('a2.oncomplete'); 
            firstWindow.close();
    
            var secondWindow = Titanium.UI.createWindow({
                title: "App SecondWindow"
           });
           secondWindow.open();
        }
    }
    
    — answered December 6th 2010 by Aaron Saunders
    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.