PDA

View Full Version : Force Ext.FlashComponent to stop playing the swf



adrin
11 Jan 2011, 8:01 AM
Hi,
I have the following code:



var toolTip = new Ext.ToolTip({
title: 'tiiitle',
autoHide: true,
hideDelay: 22,
showDelay: 20,
autoHeight: true,
target: cell,
trackMouse: true,
renderTo: document.body,
autoHeight: false,
height: record.data.Height + 20,
width: record.data.Width + 32, (..)
});

function stopFlashPreview() {
console.log('tooltip hiding');
if (this.movie) {
console.log('destroying movie!');

//this.movie is a flash component
//the following code is a mess, just trying different options
this.movie.disable();
this.movie.hide();
this.movie.destroy();
this.movie.update('');
this.movie = null;

}
}

function startFlashPreview() {
console.log('tooltip showing');
if (this.movieConfig) {
{
console.log('adding movie!');
this.movie = new Ext.FlashComponent(this.movieConfig);
this.movieHasBeenAdded = true;
}
}
}

toolTip.on('hide', stopFlashPreview, scope);
toolTip.on('show', startFlashPreview, scope);




The problem is that in IE8 the movie wont stop playing after the tooltip closes so if you are opening the tooltips very quickly the movies keep playing in the background (sound can be heard) one on top of another. In FF and chrome it seems to work fine.

The question is how do I properly send this.movie FlashComponent into oblivion or how do I stop it so that the content is not played?