Delete an actor with no rules inside it.

Is it possible to destroy an actor with no rules inside of it? I need to have as little code inside an actor as possible. What would be the easiest way to destroy an actor using code from outside the actor that is being destroyed?
Comments
--Destroy
________________
http://www.thatgameforum.com/
http://gshelper.com/
http://www.youtube.com/user/GameSaladCookbook#p/
http://gamesalad.com/wiki/
create a global attribute, say game.ActorID and a local attribute on the actor, say self.ID
on the actor put -
change attribute game.ActorID to ActorID+1 (you don't need this if you edit each instance separately but this removes the need for that and allows your to spawn new instances of the actor)
and underneath that put -
change attribute self.ID to game.ActorID
and when self.ID=game.whichID - destroy
If you spawn new instances of the actor during gameplay you will need to create another global attribute called game.whichID or something
On another actor, when you want to destroy the specific instance create a rule
when what ever happens to destroy it
change attribute game.whichID to the id of the one that you want to destroy or random(1,game.ActorID)
By the way, why on earth would you have an actor with no rules in it? An image?
And good luck with 500+ actors in one scene!
Oh and answering the very first question... no. There is probably also an easier way to destroy it but this is how I would destroy a specific instance of an actor from another.