How do you delete an Object instance created from a Class?
Below is the class from TestDestroy.as
Code:
class TestDestroy extends Key
{
public var myListen:Object
public var aNumber:Number
public var aClip:MovieClip
function TestDestroy(clip:MovieClip)
{
this.aClip=clip
this.aNumber=10
this.myListen=new Object()
Key.addListener(this.myListen)
this.myListen.onKeyDown=this.killME
}
public function killME():Void
{
trace("kill")
delete this
}
}
Now in the flas movie i have
Code:
var destroyTest:TestDestroy=new TestDestroy(_root.Ball)
trace("destroyTest:"+destroyTest)
The trace returns undefined but i can access the Object properties etc.. hence the aNumber and aClip additions.
i cant delete the Object instance from inside the class or from the main timeline.
Obviously it cant find the object as it is undefined, but list the objects when published and its there!.
Very odd
I am transfering to AS2 from AS1 and may have missed something but it is quite confusing that and object instance can exist but cant be destroyed, but can be referenced!
Any pointers gratefuilly recieved
Cheers
JOn