View Full Version : How do i call a function when new card is shown in the carousel?

24 Nov 2010, 5:06 PM
Hi, I'm very new to Sencha Touch and I have a question that MUST be simple despite my many attempts and fails. Basically, I have a carousel which pages through results as you swipe, and I want to trigger a function each time a new page is shown.
Anyone have any idea how to do this? I've tried adding a listener to it, and for some reason that doesn't work. Something like this:

var apCarousel = new Ext.Carousel({
            direction: 'horizontal',
            activeItem: 0,
            ui: 'dark',
            itemId  :   "apCarousel",
            items: pageItems,
            listeners   :   {
                click   :   {
                    element :   this,
                    fn  :   function(){alert('yo!');}
Any help would be greatly appreciated. Thanks.

24 Nov 2010, 5:16 PM

25 Nov 2010, 12:17 AM
Use a listener for the cardswitch event (on the carousel), or an listener to the activate event (on the pages)

3 Dec 2010, 12:26 PM
Thanks a lot. I knew it had to be something easy!