如何彻底删除不现实的图片和视频?PV3D
naxiaoguang (2010-06-12 09:49:31)
我做了一个图片合视频切换的功能,但是视频切回图像后视频的声音文件还存在,这说明材质没有清楚,这样会耗费内存,在切换的时候会出现重声的现象,请问该怎么彻底删除呢?material.destory()似乎不起作用。
function change_btnPress(e:MouseEvent):void
{
changeNum++
if(changeNum % 2 == 0)
{
sphere.material.destroy()
sphere.material = null
connection = new NetConnection();
connection.connect(null);
stream = new NetStream(connection);
stream.client = new Object();
video=new Video(2048,1024);
stream.play("坝凌河大桥高带宽.f4v");
video.attachNetStream(stream);
sphere.material = new VideoStreamMaterial(video,stream,true)
material.smooth = true;
trace("2222222222222222")
}
else{
sphere.material = null
sphere.material.destroy()
sphere.material = new BitmapFileMaterial("map.jpg");
material.smooth = true;
trace("44444444444")
}
}