简而言之;有没有办法取消/清除JavaFX图像的后台加载?
在代码中的某个时刻,我加载了一堆图像。出于性能方面的考虑,这些参数会在后台加载
var playPromise = document.querySelector('video').play();
// In browsers that don’t yet support this functionality,
// playPromise won’t be defined.
if (playPromise !== undefined) {
playPromise.then(function() {
// Automatic playback started!
}).catch(function(error) {
// Automatic playback failed.
// Show a UI element to let the user manually start playback.
});
}
来自Images类。
问题在于,有时用户交互会导致程序在完成先前图像的加载之前更新图像列表(而不需要先前的图像)。到那时,我想取消以前的背景加载。现在,它仍会加载以前的图像,从而导致实际需要的图像的加载时间更长。
请参见下面的示例。当我在旧资源处理完成之前获得新的资源流时,内容开始显示图像需要更长的时间,因为它仍在加载先前的资源(至少是我的猜测)。
public Image(String url, boolean backgroundLoading)