1. #1
    Ext User
    Join Date
    Apr 2010
    Posts
    4
    Vote Rating
    0
    scH is on a distinguished road

      0  

    Default 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

    PHP Code:
    var videoButton Ext.get('videoButton');
            
    videoButton.addListener(
                
    'tap',
                function(){
                
                    var 
    vid = new Ext.Panel({
                        
    floatingtrue,
                        
    modaltrue,
                        
    centeredtrue,
                        
    items: [
                            {
                                
    xtype    'video',
                                
    width    440,
                                
    height   250,
                                
    url      'movies/test.mov'
                            
    }
                        ],
                        
    cls'overlay'
                    
    });
            
                
                    
    vid.setCentered(true);
                    
    vid.show();
                    }
            ); 
    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.

    Any help is appreciated. Thanks.

  2. #2
    Ext User xnakxx's Avatar
    Join Date
    Sep 2010
    Location
    Central Valley Ca
    Posts
    84
    Vote Rating
    0
    xnakxx is on a distinguished road

      0  

    Default


    watch on of Ext.Panel's events?
    like beforedestroy,destroy,beforehide,beforeremove

  3. #3
    Ext User
    Join Date
    Apr 2010
    Posts
    4
    Vote Rating
    0
    scH is on a distinguished road

      0  

    Default


    Can you elaborate on that a bit? Maybe a tiny bit of code?

  4. #4
    Ext User
    Join Date
    Apr 2010
    Posts
    4
    Vote Rating
    0
    scH is on a distinguished road

      0  

    Default


    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({ 
                
    floatingtrue
                
    modaltrue
                
    centeredtrue
                
    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;
                }
            );
        } 
    ); 

  5. #5
    Sencha User
    Join Date
    Aug 2011
    Posts
    6
    Vote Rating
    0
    mprovencher is on a distinguished road

      0  

    Default


    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:

    Code:
    vid.addListener({
        body: {
            tap: function(){
                // all that other code
    
            }
        }, scope: this
    });
    My app wouldn't work until I added the code above.

Similar Threads

  1. [CLOSED][3.??] Chart destroy
    By nar in forum Ext 3.x: Bugs
    Replies: 4
    Last Post: 25 Aug 2010, 7:29 AM
  2. [CLOSED] Sample modal window in tutorials is not modal.
    By janusmccarthy in forum Ext 3.x: Bugs
    Replies: 2
    Last Post: 19 Apr 2010, 7:46 AM
  3. [CLOSED][3.??] GridPanel can't destroy
    By yht123 in forum Ext 3.x: Bugs
    Replies: 1
    Last Post: 20 Dec 2009, 2:18 AM
  4. [OPEN] [CLOSED][3.0.1] I can't destroy() a RadioGroup!
    By elDub in forum Ext 3.x: Bugs
    Replies: 4
    Last Post: 5 Oct 2009, 5:29 AM
  5. Modal window destroy problem
    By dddu88 in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 10 Jun 2008, 1:46 AM

Thread Participants: 2

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar