Search processing.org:

Reference for Processing (BETA) version 0135+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Name | ### this
Examples |
    float ypos = 50;

    void setup() {
      size(100, 100);
      noLoop();
    }

    void draw() {
      line(0, 0, 100, ypos);
      this.ypos = 100;
      line(0, 0, 100, ypos);
    }
    import processing.video.*;
    Movie myMovie;

    void setup() {
      size(200, 200);
      background(0);
      myMovie = new Movie(this, "totoro.mov");
      myMovie.loop();
    }

    void draw() {
      if(myMovie.available()) {
        myMovie.read();
      }
      image(myMovie, 0, 0);
    }
Description | Refers to the current object (i.e. "this object"). In Processing, it's most common to use this to pass a reference from the current object into one of the libraries. The keyword this can also be used in another way, but it is often not necessay. For example, if you are calling the filter() method of a PImage object named tree from another object, you would write tree.filter(). To call this method inside PImage itself one could simply write filter() or could more explicity write this.filter(). It's not incorrect to say this.filter() but it is not necessary as this is always implied.
Syntax |
    this
Parameters |
Usage | Web & Application

Updated on December 20, 2005 02:03:00pm PST