import proxml.*; PFont f; // create a new array to hold all our new particles Obits[] obits; int currentobits = 0; // keep track of whether we are in grab mode boolean issomethinggrabbed = false; boolean button = false; Wedding[] weddings; int currentweddings = 0; //requesting our XML file XMLInOut xmlInOut; XMLInOut xmlInOutWedding; void setup(){ size(800,500); smooth(); //bringing in our font f = loadFont("Helvetica-12.vlw"); //initializing our array with a maximum of 100 objects obits = new Obits[100]; weddings = new Wedding[100]; xmlInOut = new XMLInOut(this); try{ xmlInOut.loadElement("Obituaries.xml"); println( xmlInOut); } catch(Exception e){ println("error"); } xmlInOutWedding = new XMLInOut(this); try{ xmlInOutWedding.loadElement("Weddings.xml"); } catch(Exception e){ println("error"); //if the xml file could not be loaded it has to be created //xmlEvent(new XMLElement("ellipses")); } } void xmlEvent(XMLElement element){ boolean weddingflag = false; boolean obitflag = false; println(element.getName()); XMLElement channel = element.getChild(0); println(channel.getName()); XMLElement[] channelsChildren = channel.getChildren(); for(int i=0; i Weddings/Celebrations")) { weddingflag = true; } if (tmp.getChild(0).getText().equals("NYT > Obituaries")) { obitflag = true; } } if(tmp.getName().equals("item")) { //println(tmp.getChild(0).getName()); if (obitflag == true) { println("****" + tmp.getChild(0).getChild(0).getText()); obits[currentobits] = new Obits(200, height/2, 20, tmp.getChild(0).getChild(0).getText()); // obits[currentobits] = new Obits(250, height/2, 20); currentobits++; } // only put in weddings if we are pulling from the wedding XML file if (weddingflag == true) { weddings[currentweddings] = new Wedding(600, height/2, 20, tmp.getChild(0).getChild(0).getText()); // weddings[currentweddings] = new Wedding(750, height/2, 20); currentweddings++; println ("----- we have a wedding! " + tmp.getChild(0).getChild(0).getText()); } //print("item!"); } } } void draw(){ background(255); //changing particles if mouse rollover /* if(obits[counter].button(mouseX,mouseY)){ if(obits[counter].linking == false) { obits[counter].linking = true; link("http://newyorktimes.com"); } } else { obits[counter].reducesize(); } */ for (int counter = 0; counter < currentobits; counter++) { obits[counter].display(); //changing particles if mouse rollover if(obits[counter].button(mouseX,mouseY)){ if(obits[counter].linking == false) { obits[counter].linking = true; link("http://www.nytimes.com/pages/obituaries/"); } } if(obits[counter].rollover(mouseX,mouseY)){ // check to see if we are already expanding another bubble - if we aren't, expand this bubble // and prevent other bubbles from expanding if (issomethinggrabbed == false) { obits[counter].iamchosen = true; issomethinggrabbed = true; } // the chosen one's free pass to continue to grow even though something is grabbed if (obits[counter].iamchosen == true) { obits[counter].change(); } // if (weddings[counter].iamchosen == true){ // weddings[counter].mousePressed(); // } } else { obits[counter].reducesize(); // when we have released the chosen one, tell it to reduce in size and allow us to grab another bubble if (obits[counter].iamchosen == true) { obits[counter].iamchosen = false; issomethinggrabbed = false; } } } for (int counter = 0; counter < currentweddings; counter++) { weddings[counter].display(); //changing particles if mouse rollover if(weddings[counter].rollover(mouseX,mouseY)){ // check to see if we are already expanding another bubble - if we aren't, expand this bubble // and prevent other bubbles from expanding if (issomethinggrabbed == false) { weddings[counter].iamchosen = true; issomethinggrabbed = true; } // the chosen one's free pass to continue to grow even though something is grabbed if (weddings[counter].iamchosen == true) { weddings[counter].change(); } // if (weddings[counter].iamchosen == true){ // weddings[counter].mousePressed(); // } } else { weddings[counter].reducesize(); // when we have released the chosen one, tell it to reduce in size and allow us to grab another bubble if (weddings[counter].iamchosen == true) { weddings[counter].iamchosen = false; issomethinggrabbed = false; } } } }