5 Replies Latest reply on Dec 8, 2006 3:23 AM by Newsgroup_User

    prototype

    steeban
      MovieClip.prototype.onRelease = function(){
      trace ("working");
      delete this; // what this delete will remove
      };
      box2.onRelease();


      what the statement "delete this" will remove? actually what that will perform.....

      anyone know this....????
        • 1. Re: prototype
          kglad Adobe Community Professional & MVP
          it removes nothing. it's trying to "delete" the movieclip box2 (or any other movieclip that uses that onRelease method).
          • 2. Re: prototype
            steeban Level 1
            tries to delete means... whether it will delete the movieclip or not... how to check whether it has deleted or not...
            • 3. Re: prototype
              Marghoob Suleman Level 1
              hi steeban,
              delete command is used to delete a variable. it does not delete a movieclip. and is it necessary to have 'delete this' in that prototype.? i dont think so...

              for a testing purpose i've used following method. it does not even delete a variable of a movieclip.
              have a look...

              box2.name = "rectangle" //defined a variable on a movieclip
              MovieClip.prototype.onRelease = function() {
              trace("==============before=================")
              trace("box2.name: " + box2.name);
              delete this;
              trace("==============after=================")
              trace("box2.name: " + box2.name);

              };
              box2.onRelease();

              So what you say... is it neccesary to have "delete this"
              or if you know something about why should use "delete this"? would be great.

              Thanks



              • 4. Re: prototype
                Level 7
                'delete this' is just complete nonsense .. because you must follow delete
                with a variable name. 'this' is a special keyword, its not a variable.
                --
                Jeckyl



                • 5. Re: prototype
                  Level 7
                  > MovieClip.prototype.onRelease = function(){
                  > trace ("working");
                  > delete this;
                  > // what this delete will remove
                  > };
                  > box2.myNewReleaseFunction();

                  > what the statement delete this will remove?

                  It will do nothing because it is a legal statement. 'this' is a keyword and
                  is NOT a variable name. 'delete' must be followed by a variable name,
                  because 'delete' deletes variables (not objects).

                  Whoever wrote this obviously does not understand what either 'delete' or
                  'this' means.
                  --
                  Jeckyl