Thanks, it works fine as expected using the following code :
Code:
horizontalCarousel.on("activeitemchange", function(me, value, oldValue, index)
{
console.log(horizontalview[this.getActiveIndex()] + '-' + this.getActiveIndex());
});
And my whole code :
Code:
var Myapp = Ext.application(
{
name: 'Myapp',
launch: function()
{
var horizontalCarousel;
var verticalCarousels = [];
var items, i, j;
/* ------------------------------------------------ */
/* Vertical items */
/* ------------------------------------------------ */
//alert("nbHorizontalItems="+nbMaxMainScreen);
for ( i=0 ; i<nbMaxMainScreen ; i++ )
{
items = [];
/* ------------------------------------------------ */
/* Horizontal items */
/* ------------------------------------------------ */
//alert("nbVerticalItems="+nbMaxSubScreenPerMainScreen[i]);
for ( j=0 ; j<nbMaxSubScreenPerMainScreen[i] ; j++ )
{
//alert("i="+i+"/j="+j);
//alert("content["+i+"]["+j+"]="+mainScreen[i][j]);
items.push(
{
html : mainScreen[i][j],
style: 'background-color: #FFFFFF'
});
}
/* ------------------------------------------------ */
/* Fill vertical's carousel */
/* ------------------------------------------------ */
verticalCarousels.push(
{
xtype: 'carousel',
direction: 'vertical',
cardSwitchAnimation: 'slide',
directionLock: true,
id: vcarousselID[i],
items: items,
itemConfig:
{
cls: 'my-carousel-item'
}
});
}
/* -------------------------------------------------- */
/* Link the vertical carousel with the horizontal one */
/* -------------------------------------------------- */
horizontalCarousel = Ext.Viewport.add(
{
xtype: 'carousel',
direction: 'horizontal',
cardSwitchAnimation: 'slide',
id: 'hcarouselID',
items: verticalCarousels
});
/* -------------------------------------------------- */
/* Define callbacks for horizontal transition */
/* -------------------------------------------------- */
horizontalCarousel.on("activeitemchange", function(me, value, oldValue, index)
{
console.log(horizontalview[this.getActiveIndex()] + '-' + this.getActiveIndex());
});
/* -------------------------------------------------- */
/* Initialize the default horizontal carousel */
/* -------------------------------------------------- */
//horizontalCarousel.setActiveItem(hcurcarousel); // Horizontal init
//horizontalCarousel.getActiveItem().setActiveItem(0); // Vertical init
}
});