【发布时间】:2012-03-04 21:00:50
【问题描述】:
我在弹出窗口中实施销毁方法时遇到了困难。一切正常,下面的代码适用于让一个弹出窗口根据点击的内容更改其内容。但我注意到隐藏弹出窗口时我的内容(媒体)仍在播放。我想完全摧毁它,然后点击重新创建。我在论坛中并没有真正找到任何可以帮助我实现这一目标的东西,所以我认为它也会对其他人有所帮助:-)
有几件事让我感到困惑,因为标记上已经有一个点击监听器,它会启动弹出窗口,我应该将销毁代码放在哪里?我是否应该将它声明为弹出窗口之外的单独函数,然后以某种方式在隐藏之前调用它?
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?
谢谢,
迪吉里杜普
【问题讨论】:
标签: popup sencha-touch extjs destroy