I mean, do I have to delete DisplayObject objects through AS or throug开发者_开发百科h clearing keyframe in Flash? Or is that the same?
Whether you "have to" remove them depends on what you want to do. You have to remove them (using removeChild()
) from the display list for the garbage collector to collect them (and free their memory). Clearing a key frame in Flash Pro will result in the object being removed from the stage, but I'm not sure whether it is also removed from memory (because it might be kept around for when it appears again, e.g. in a looping MovieClip.)
The delete
keyword is barely used in ActionScript, and especially not in the same way as C++ for instance, where it's used to deallocate an object's memory. Instead, delete
can only be used to remove a property from a dynamic object, e.g.
var obj : Object = {};
obj.name = 'foo'; // Creating the name property on dynamic Object
delete obj.name; // Removing the name property
trace(obj.name); // "undefined"
Please try to clarify your question. If you give a little context it might be easier to conclude what you're really asking, and give a more relevant answer.
精彩评论