2012-02-13 3 views
1
)

내 팝업에서 destroy 메소드를 구현하는 데 어려움이 있습니다. 모든 것이 잘 작동합니다. 아래 코드는 클릭 한 내용에 따라 내용을 변경하는 팝업이 하나있는 경우 작동합니다. 그러나 나는 팝업 (팝업)을 숨길 때 내 콘텐츠 (미디어)가 계속 재생된다는 것을 알았습니다. 나는 그것을 완전하게 파괴하고 클릭 할 때 다시 만들고 싶습니다. 나는 이것을 달성하는 데 도움이되는 포럼에서 실제로 아무 것도 발견하지 못했습니다. 그래서 다른 사람들에게도 도움이 될 것이라고 생각합니다 :-)Sencha Touch에서 내 팝업을 올바르게 파괴하는 방법 (

이미 마커에 클릭 리스너가 있기 때문에 몇 가지 혼란이 있습니다. , 팝업을 시작합니다. 파괴 코드는 어디에 두어야합니까? 내가 팝업 밖에서 별도의 함수로 선언해야하고, 그 전에 어떻게 든 숨 깁니다.

function addMarker(country) 
     { 
    if (true) 
      { 
     var image = new google.maps.MarkerImage(country.image48Path); 
     var marker = new google.maps.Marker({ 
     map: map.map, 
     title: country.title, 
     position: country.position, 
     //draggable: true, 
     icon:image 
     }); 


     var goToCountryWrapper = function (button, event) 
       { 
        goToCountry(country, this.popup); 
     }; 


     google.maps.event.addListener(marker, 'click', function() 
       { 
     if (!this.popup) 
        { ---> Should I be placing destroy code here? 
      this.popup = new Ext.Panel(
          { 
      floating: true, 
      modal: true, 
      centered: true, 
      width: 800, 
      height: 600, 
      styleHtmlContent: true, 
      scroll: 'vertical', 
      items:[(new countryOverlay(country)).overlayPanel, 
      { 
       xtype:'button', 
       margin: 20, 
       ui:'action-round', 
       text:'Click here to view more promo videos', 
       handler:goToCountryWrapper, 
       scope : this 
      },], 
       layout: { 
       type: 'auto', 
       padding: '55', 
       align: 'left' 
      }, 
      dockedItems: [{ 
       dock: 'top', 
       xtype: 'toolbar', 
       ui: 'light', 
       title: country.title 
       }], 
    ---> Should I be placing a listener here for beforehide, destroying here? 
      }); 
     }; 
     this.popup.show('pop'); 

     });  
    } 
    }; 

---> Should I be placing the destroy code after, as a seperate function? 

감사합니다,

Digeridoopoo

답변

2

당신이 팝업을 숨길 때 당신이 그것을 파괴하려는 가정? 그렇다면, 당신은 그가 이벤트를 숨기고 그 후에 그것을 파괴하는 토륨을 경청해야한다.

this.popup.on('hide', function() { 
    this.popup.destroy(); 
}, this); 
0

확인이

   hideOnMaskTap:true, 
        listeners : { 
         hide: function() { 
          this.destroy(); 
          } 
        }, 
관련 문제