-
16 Dec 2010 1:16 PM #1
Destroy a Modal Pane when it's closed
Destroy a Modal Pane when it's closed
So, I have a video that I'm launching in a floating modal overlay, however when you close the pane the video keeps playing in the background.
I'm not sure whether I need to capture the tap that closes the overlay and create a listener that destroys the pane or if there's an easier way with bubbleEvents
I'm currently declaring the video itself in the overlay function so that once it's destroyed a new version can be created anytime I want, however it might also work to have the video declared outside of the function and simply pause the video when the user closes it. Still I have the same issue with knowing when the overlay is closed.PHP Code:var videoButton = Ext.get('videoButton');
videoButton.addListener(
'tap',
function(){
var vid = new Ext.Panel({
floating: true,
modal: true,
centered: true,
items: [
{
xtype : 'video',
width : 440,
height : 250,
url : 'movies/test.mov'
}
],
cls: 'overlay'
});
vid.setCentered(true);
vid.show();
}
);
Any help is appreciated. Thanks.
-
16 Dec 2010 4:41 PM #2
watch on of Ext.Panel's events?
like beforedestroy,destroy,beforehide,beforeremove
-
20 Dec 2010 10:28 AM #3
Can you elaborate on that a bit? Maybe a tiny bit of code?
-
21 Dec 2010 11:26 AM #4
Thanks for the pointer to "beforehide" Just thought I'd post my solution:
PHP Code:var videoButton = Ext.get('videoButton');
videoButton.addListener(
'tap',
function(){
var vid = new Ext.Panel({
floating: true,
modal: true,
centered: true,
items: [
{
xtype : 'video',
width : 440,
height : 250,
url : 'movies/test.mov'
}
],
cls: 'overlay'
});
vid.setCentered(true);
vid.show();
vid.addListener(
'beforehide',
function (){
vid.destroy();
return true;
}
);
}
);
-
7 Sep 2011 10:18 AM #5
This helped me SO much. Just a point to add, you have to render the listener (not sure if that's the right language) to either the body or the element:
My app wouldn't work until I added the code above.Code:vid.addListener({ body: { tap: function(){ // all that other code } }, scope: this });
Similar Threads
-
[CLOSED][3.??] Chart destroy
By nar in forum Ext 3.x: BugsReplies: 4Last Post: 25 Aug 2010, 7:29 AM -
[CLOSED] Sample modal window in tutorials is not modal.
By janusmccarthy in forum Ext 3.x: BugsReplies: 2Last Post: 19 Apr 2010, 7:46 AM -
[CLOSED][3.??] GridPanel can't destroy
By yht123 in forum Ext 3.x: BugsReplies: 1Last Post: 20 Dec 2009, 2:18 AM -
[OPEN] [CLOSED][3.0.1] I can't destroy() a RadioGroup!
By elDub in forum Ext 3.x: BugsReplies: 4Last Post: 5 Oct 2009, 5:29 AM -
Modal window destroy problem
By dddu88 in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 10 Jun 2008, 1:46 AM


Reply With Quote