Remember / open()

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:
@EditableColor color bgColor = 0xFFFFFFFF; 

Commands commands;
Remember remember;

GripDispatcher dispatch;
Tinker tinker;

void setup() {
   size(720, 360);
   dispatch = new GripDispatcher(this);
   tinker = new Tinker(this);

   remember = new Remember(this);
   commands = new Commands(this);
   commands.add("open", remember, CONTROL, 'o');
}

void draw() {
   background(bgColor);
   dispatch.update();
   dispatch.draw();
}

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

Prompts the user to choose an xml file describing a composition. The xml file will be parsed by the loadXML() method.

Syntax
remember.open()
remember.open(filename)
Parameters
None
Returns
None
Usage
Web & Applications
Related
Last Modified: April 18, 2010

No Comments

You must be logged in to post a comment.