Groups | Blog | Home
all groups > flash actionscript > january 2006 >

flash actionscript : Deleting Classes


Motion Maker
1/29/2006 3:15:26 PM
Not sure if memory required for a Class is deleted. But the delete statement
removes it from use.
http://livedocs.macromedia.com/flash/8/main/00001865.html.

I tried this:
import TestClass;
myTestClass1 = new TestClass();
delete TestClass;;
myTestClass2 = new TestClass();

In Control-Test Movie using Debug->List Variables with the delete line
commented and uncommented it appears the class definition is deleted with
the delete statement but objects referencing it are still there and new
objects cannot be created. What it does for memory is not clear.

Flash works with garbage collection technology and once an item is deleted,
then when the garbage collector comes into town it picks up items deleted
with delete. Flash 8 player is supposed to have improved this another reason
to movie visitor spec profiles up for new intense apps in progress.

I believe you are talking about a few k of memory? Flash optimizes the code
when published. Take a look at just that class imported into a blank fla and
publish to get the swf size or look at the file size report selected in
File->Publish Settings Flash tab when you Control->Test Movie.

--
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
[quoted text, click to view]
I have a number of functions in a class i call Init. It is about 1000 lines
of code. Can I delete the class after it is run to restore memory for data?

all help apprecaited.

bob

bderber
1/29/2006 5:08:27 PM
I have a number of functions in a class i call Init. It is about 1000 lines of code. Can I delete the class after it is run to restore memory for data?

all help apprecaited.

AddThis Social Bookmark Button