oopSuicide

  how to create globals on the fly /from variables and an example of a parent script which creates and voids its own global reference.
OOP memory trash




  script erase itself from memory
>Q: how do I have a script erase itself from memory?

Basically, I do it like this,
(only I usually collect those suicide calls in a list of trash 
that is emptied regularily triggered by some other event)


-- movie script

on makeObject scriptObj
  global gLpObjects
  if voidP(gLpObjects) then set gLpObjects = [:]
  set dObj = new (script scriptObj)
  set dObjId = getId(dObj)
  addprop gLpObjects,dObjId,dObj
end

on KillObject dbjId
  global gLpObjects
  set da = findPos(gLpObj,dObjId) 
  if da then deleteAt gLpObjects,da
end

--Parent script

property myId
on new me
       set myId = #SomethingSpecial
	return me
end me
on rubOut me
	killObject myId
end


Best regards

Daniel Plaenitz 
.......................
dp@lingo.de
<http://www.lingo.de>

Home shock + cgi Bits 'n pieces Director Lingo Shocklets Contact










pageID=l_oopSuicide