1 Reply Latest reply on May 4, 2007 8:32 AM by Newsgroup_User

    How to delete an object of a custom class


      Can anyone please tell me how to delete an object of a class so that the object stops running/ceases?
      I have included a simple example.

      How can I stop flash from tracing "Class is playing"?

        • 1. Re: How to delete an object of a custom class
          Level 7
          You are deleting the object. Try this in your movie - make a button, give it
          an instance name 'btnDelete', and using your existing Class:

          var c:DeleteThisClass = new DeleteThisClass();
          btnDelete.onPress = function() {
          trace("c = "+c);
          var bDelete:Boolean = delete c;
          trace("bDelete = "+bDelete);
          trace("now c = "+c);

          You'll see this traced:

          c = [object Object]
          bDelete = true
          now c = undefined

          However, in your Class, you are assigning an enterFrame handler to the _root
          of your movie. Deleting the Class object won;t delete this handler, as it is
          independent of the Class object. Make sense?


          Remove '_spamkiller_' to mail