Remember / openLast()

An applet for this method is omitted. This method is only useful when running Processing locally (not on the internet).


// Saves a composition that consists of a single color 
import compose.*; 
 
// The only thing we're saving: 
// We set it for the first time in setup() if openLast() returns false
@EditableColor color bgColor;  

Remember remember; 

void setup() { 
   size(720, 360); 
   remember = new Remember(this); 
   if (!remember.openLast()) {
      bgColor = color(255);
   }
} 
 
void draw() { 
   background(bgColor); 
} 
 
XMLElement getXML() { 
 
   XMLElement compositionNode = new XMLElement(); 
   compositionNode.setName("color"); 
 
   // Here's a quick way to change an number to a String: 
   String bgColorAsString = bgColor + ""; 
 
   compositionNode.setAttribute("value", bgColorAsString);  
 
   return compositionNode; 
 
} 
 
void loadXML(XMLElement xml) { 
   bgColor = xml.getIntAttribute("value"); 
} 
Description

Opens the last modified xml file in the output directory. Use this in your setup method so you can begin working on your latest composition right away. This method returns false if the output directory is empty, in which case you should instantiate a “default” composition.

Syntax
if (!remember.openLast()) {
   // instantiate stuff
}
Parameters
None
Returns
False if the output directory is empty
Usage
Web & Applications
Related
Last Modified: April 18, 2010

No Comments

You must be logged in to post a comment.