Closed amigoni closed 10 years ago
There is something strange. If the blurImage has a pointer outside of this function that creates it then it won't be removed. If it has no pointer, meaning that I don't assign the return to anything it works just fine.
var mod = require('bencoding.blur');
var blurImage = Ti.UI.createView({
backgroundImage: worldContainer.currentWorld.toImage(),
height: Ti.UI.FILL,
width: Ti.UI.FILL
});
var blurView = mod.createView({
height:win.height,
width:win.width,
//top:0,bottom:0,left:0,right:0,
blurLevel:5,
blurTintColor: "#666666",
backgroundView:blurImage,
//blurCroppedToRect:true,
});
blurImage.blurView = blurView;
blurImage.add(blurView);
/*
function RemoveBlur(){
win.remove(blurImage);
}
*/
//blurImage.RemoveBlur = RemoveBlur;
win.add(blurImage);
setTimeout(function(){win.remove(blurImage)},10000)
return blurImage;
You have to null all you add to controllers, out again before you remove
them. e.g.
function RemoveBlur(){ blurImage.RemoveBlur = null; win.remove(blurImage); }
I think this will work. I have not tested it. Maybe it will not help in
your case. But, at least to remove things completly from the memmory.
På Sat, 01 Mar 2014 17:13:13 +0100, skrev Leonardo Amigoni
notifications@github.com:
There is something strange. If the blurImage has a pointer outside of
this function that creates it then it won't be removed. If it has no
pointer, meaning that I don't >assign the return to anything it works
just fine.var mod = require('bencoding.blur'); var blurImage = Ti.UI.createView({ backgroundImage: worldContainer.currentWorld.toImage(), height: Ti.UI.FILL, width: Ti.UI.FILL });
var blurView = mod.createView({ height:win.height, width:win.width, //top:0,bottom:0,left:0,right:0, blurLevel:5, blurTintColor: "#666666", backgroundView:blurImage, //blurCroppedToRect:true,
});
blurImage.blurView = blurView;
blurImage.add(blurView);
/ function RemoveBlur(){ win.remove(blurImage); } /
//blurImage.RemoveBlur = RemoveBlur; win.add(blurImage); setTimeout(function(){win.remove(blurImage)},10000)
return blurImage;
— Reply to this email directly or view it on GitHub.
@colorhat I thought the same but it doesn't seem to be the issue. I will do more testing and post some good sample code this afternoon.
Here is some code. But I can add a blurred image with no problem except some lag. But then when I try to remove it from the window. It says that it's not a child.
var mod = require('bencoding.blur');