i'm trying to remove a tween object after it has complete so the memory can be freed by garbage collection.
in this example i'm passing the fadeIn function a UILoader object that is cast as a sprite so that it fades in when it is finished loading. when the tween finishes animating, i want to remove the tween object. i've included the compiler errors as comments.
function fadeIn(e:Sprite):void
{
var myTween:Tween = new Tween(e, "alpha", None.easeNone, 0.0, 1.0, 0.2, true);
myTween.addEventListener(Event.COMPLETE, deallocateObject, false, 0, true);
}
function deallocateObject(e:Event):void
{
//delete(e.currentTarget); //Warning: 3600: The declared property currentTarget cannot be deleted. To free associated memory, set its value to null.
e.currentTarget = null; //1059:Property is read-only.
}