我在彈出窗口中執行銷燬方法時遇到困難。一切工作正常,下面的代碼適用於有一個彈出窗口根據點擊的內容更改其內容。但我注意到當隱藏彈出窗口時,我的內容(媒體)仍在播放。我想徹底銷燬它,然後點擊重新創建。我還沒有真正發現任何可以幫助我實現這個目標的論壇,所以我認爲它也會幫助其他人:-)如何在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