<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7036346606788760601</id><updated>2012-02-16T00:03:04.644-08:00</updated><title type='text'>from flashWonders to ProcessingMiracles</title><subtitle type='html'>About FLASH AS3 scripting possibilities, connecting to media, database, AR and others.
And now exploring Processing, starting datavisualisations</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>32</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-1802920902839899413</id><published>2011-07-18T03:00:00.000-07:00</published><updated>2011-07-18T03:00:58.215-07:00</updated><title type='text'>Rotating an image in Processing</title><content type='html'>Just taking the basic example LoadDisplayImage and letting the images rotate independent of each other:&lt;br /&gt;&lt;a href=" http://www.contrechoc.com/crosslab/applet/rotateDisplayImage.html"&gt;&lt;br /&gt;http://www.contrechoc.com/crosslab/applet/rotateDisplayImage.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;PImage a;  // Declare variable "a" of type PImage&lt;br /&gt;float theta = 0;//rotating angle in degrees&lt;br /&gt;void setup() {&lt;br /&gt;size(200, 200);&lt;br /&gt;a = loadImage("jelly.jpg");  // Load the image into the program  &lt;br /&gt;}&lt;br /&gt;void draw() {&lt;br /&gt;// Displays the image at its actual size at point (0,0)&lt;br /&gt;pushMatrix();//used to get an independent rotation&lt;br /&gt;translate(width/2, height/2);&lt;br /&gt;rotate(radians(theta));&lt;br /&gt;translate(-a.width/2, -a.height/2);&lt;br /&gt;image(a, 0, 0); &lt;br /&gt;popMatrix();//sort of boundaries for a rotation translation&lt;br /&gt;pushMatrix();//start another rotation&lt;br /&gt;translate(width/4, height/4);&lt;br /&gt;rotate(radians(-2*theta));&lt;br /&gt;translate(-a.width/4, -a.height/4);&lt;br /&gt;image(a, 0, 0,  a.width/2,  a.height/2); &lt;br /&gt;popMatrix();//&lt;br /&gt;theta+=1;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-1802920902839899413?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/1802920902839899413/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/05/rotating-image-in-processing.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/1802920902839899413'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/1802920902839899413'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/05/rotating-image-in-processing.html' title='Rotating an image in Processing'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-9062166636185613890</id><published>2011-06-18T21:48:00.000-07:00</published><updated>2011-06-18T21:48:48.148-07:00</updated><title type='text'>Playing with text() and pixels</title><content type='html'>&amp;nbsp;Two excellent examples using text, the first takes a picture and a text on top, and makes the letters bigger where the picture is brigther, a fine start for more experiments:&lt;br /&gt;&lt;br /&gt;http://www.learningprocessing.com/exercises/chapter-17/exercise-17-7/&lt;br /&gt;&lt;br /&gt;The second example is using textWidth:&lt;br /&gt;&lt;code&gt;&lt;br /&gt; x += textWidth(message.charAt(i)); &lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;So you can get the pixelNumber where your letter starts. In this way you can use letters of different sizes in the same bit of text.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-9062166636185613890?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/9062166636185613890/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/06/playing-with-text-and-pixels.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/9062166636185613890'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/9062166636185613890'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/06/playing-with-text-and-pixels.html' title='Playing with text() and pixels'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-4884092858995452580</id><published>2011-06-16T11:40:00.000-07:00</published><updated>2011-06-16T11:40:33.908-07:00</updated><title type='text'>Input textfield, sliders, buttons etc</title><content type='html'>Well for these fancy objects, which are not easy to program from scratch, you can use this library:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sojamo.de/libraries/controlP5/"&gt;http://www.sojamo.de/libraries/controlP5/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Example code:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.openprocessing.org/visuals/?visualID=20726"&gt;http://www.openprocessing.org/visuals/?visualID=20726&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;as usual download the library, unzip, and pu this folder in the folder libraries inside the Processing folder with your sketches. In this folder there are lots of examples, buttons sliders....&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-4884092858995452580?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/4884092858995452580/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/06/input-textfield-sliders-buttons-etc.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/4884092858995452580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/4884092858995452580'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/06/input-textfield-sliders-buttons-etc.html' title='Input textfield, sliders, buttons etc'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-8511308308097168676</id><published>2011-06-14T12:11:00.000-07:00</published><updated>2011-08-22T06:59:55.192-07:00</updated><title type='text'>Searching......</title><content type='html'>Just a few downloads to wonder about all the data floating around....&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.contrechoc.com/crosslab/dataBaseStuff.zip"&gt;http://www.contrechoc.com/crosslab/dataBaseStuff.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;with and extra example adding to the last post ( database_patterns_6.pde )&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-5MbVPMGlz1w/TfnQOclZIOI/AAAAAAAABZU/94NLUkh032o/s1600/datapatterns6.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://2.bp.blogspot.com/-5MbVPMGlz1w/TfnQOclZIOI/AAAAAAAABZU/94NLUkh032o/s400/datapatterns6.jpg" width="384" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;with examples searching the NYT, Google and Twitter&lt;br /&gt;&lt;br /&gt;for the nyt API you need your own key, and insert it into this line:&lt;br /&gt;TimesEngine.init(this,"get your own API key"); // http://developer.nytimes.com/&lt;br /&gt;this line of code becomes something like:&lt;br /&gt;&lt;br /&gt;TimesEngine.init(this,"87238269346827638476283764827638476287364872638576"); //fake key!&lt;br /&gt;&lt;br /&gt;as indicated in the script, you can get your key here: &lt;a href="http://developer.nytimes.com/"&gt;http://developer.nytimes.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;also, the right libraries are added (JSON). You have to put these libraries in the folder libraries inside the Processing folder containing your sketches.&lt;br /&gt;&lt;br /&gt;And then a few links: &lt;br /&gt;&lt;a href="http://www.blogger.com/goog_634800870"&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://searchenginewatch.com/article/2066257/What-People-Search-For-Most-Popular-Keywords"&gt;http://searchenginewatch.com/article/2066257/What-People-Search-For-Most-Popular-Keywords&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Or search for: youtube professor Hans Rosling.....&lt;br /&gt;&lt;a href="http://www.youtube.com/watch?v=YpKbO6O3O3M&amp;amp;feature=relmfu"&gt;http://www.youtube.com/watch?v=YpKbO6O3O3M&amp;amp;feature=relmfu&lt;/a&gt;&lt;br /&gt;&lt;a href="http://lowfrequency.org/interactivity/wiki/index.php?title=Google_API_In_Processing"&gt;&lt;br /&gt;http://lowfrequency.org/interactivity/wiki/index.php?title=Google_API_In_Processing&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The google Image API is also not too difficult and can be exciting for designers:&lt;br /&gt;&lt;a href="http://lowfrequency.org/interactivity/wiki/index.php?title=GoogleJSONSearchDrawImage"&gt;http://lowfrequency.org/interactivity/wiki/index.php?title=GoogleJSONSearchDrawImage&lt;/a&gt;&lt;br /&gt;You need the JSON library, but when you have the nyt examples (above) running, this library is included.&lt;br /&gt;&lt;br /&gt;This link gives an example with 1 image, but displaying 4 images can be done like this:&lt;br /&gt;&lt;br /&gt;in the declarations, instead of one image take an array&lt;br /&gt;&lt;code&gt;&lt;br /&gt;PImage myImg[] = new PImage[4];&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;in setup() load for images:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;for(int i=0; i&amp;lt;4 ; i++){    myResult = getFirstSearchResult("bullet cluster",i);   PImage getImage = new PImage();   getImage =  loadImage(myResult);   println( "------------&amp;gt;"+ str(i) + " " + myResult );&lt;br /&gt;myImg[i] = getImage;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;this to add in the draw:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;for(int i=0; i&amp;lt;2 ; i++)     for(int j=0; j&amp;lt;2 ; j++){       iCounter++;       image(myImg[iCounter],  i*width/2, j*height/2, width/2, height/2);     } &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;and this works with a minor change in the function:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;String getFirstSearchResult(String query, int imageNumber) &lt;br /&gt;{&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;this leaves one line in this function to get more than result one:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;URL url = new URL(baseURL + "?start="+str(imageNumber)+"&amp;amp;rsz=large&amp;amp;v=1.0&amp;amp;q=" + query);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;You can find this script in this download:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.contrechoc.com/crosslab/dataBaseStuff.zip"&gt;http://www.contrechoc.com/crosslab/dataBaseStuff.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-YorPZiZCE-U/TfnVN0_2inI/AAAAAAAABZo/zQ-xt1wd-GU/s1600/Google%2BAPI%2B4%2Bimages.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://1.bp.blogspot.com/-YorPZiZCE-U/TfnVN0_2inI/AAAAAAAABZo/zQ-xt1wd-GU/s400/Google%2BAPI%2B4%2Bimages.jpg" width="385" /&gt;&lt;/a&gt;&lt;/div&gt;four images of the search for "bullet cluster"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;All about the Google API's can be found here:&lt;br /&gt;&lt;a href="http://code.google.com/apis/maps/index.html"&gt;http://code.google.com/apis/maps/index.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-8511308308097168676?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/8511308308097168676/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/06/searching.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/8511308308097168676'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/8511308308097168676'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/06/searching.html' title='Searching......'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-5MbVPMGlz1w/TfnQOclZIOI/AAAAAAAABZU/94NLUkh032o/s72-c/datapatterns6.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-7790690952159775</id><published>2011-06-09T03:05:00.000-07:00</published><updated>2011-06-16T02:50:00.551-07:00</updated><title type='text'>A few Processing Examples</title><content type='html'>Here you can find some simple examples: &lt;a href="http://www.contrechoc.com/crosslab/databaseSamples.zip"&gt;http://www.contrechoc.com/crosslab/databaseSamples.zip&lt;/a&gt;&lt;br /&gt;have fun!&lt;br /&gt;&lt;br /&gt;Basically these examples build from simple text on a screen, color changing, to text and image, interactively displayed (on mouseDrag and mousePressed);&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-_uycyzP4qzc/TfnRDgI2ZGI/AAAAAAAABZY/cwN6IKyjyCs/s1600/datapattern1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-_uycyzP4qzc/TfnRDgI2ZGI/AAAAAAAABZY/cwN6IKyjyCs/s320/datapattern1.jpg" width="308" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-fnsmvgaKmBc/TfnRD5X97xI/AAAAAAAABZc/4n3kJnM1vrA/s1600/datapattern2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-fnsmvgaKmBc/TfnRD5X97xI/AAAAAAAABZc/4n3kJnM1vrA/s320/datapattern2.jpg" width="308" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-gR3AQxUVEWw/TfnRj0bF7WI/AAAAAAAABZg/1e1aY4iYk14/s1600/datapatterns5.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/-gR3AQxUVEWw/TfnRj0bF7WI/AAAAAAAABZg/1e1aY4iYk14/s320/datapatterns5.jpg" width="306" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-7790690952159775?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/7790690952159775/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/06/few-processing-examples.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/7790690952159775'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/7790690952159775'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/06/few-processing-examples.html' title='A few Processing Examples'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-_uycyzP4qzc/TfnRDgI2ZGI/AAAAAAAABZY/cwN6IKyjyCs/s72-c/datapattern1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-1457280280548838792</id><published>2011-05-23T00:02:00.000-07:00</published><updated>2011-05-23T07:55:01.481-07:00</updated><title type='text'>Making and using a simple Object</title><content type='html'>Although you can do a lot of nice things just programming around (called "knitting") sometimes you meet things like objects and classes.&lt;br /&gt;Some basic knowledge of Object Orientated ( "OO" ) programming may be useful.&lt;br /&gt;In this post I present a simple example of a class, with which you can make objects.&lt;br /&gt;A class is a black box. With this black box you can produce your own "things", for instance records of a name and an amount of payment.&lt;br /&gt;So we have a name, "Beam" and we have a payment "1.75". In a so called constructor these are tied together. Later on we can get these data out again.&lt;br /&gt;&lt;br /&gt;A class can save these data, but can also have functions. Like the data, these functions are also tailor made.&lt;br /&gt;In your main sketch you can make the TestClass object like this:&lt;code&gt;&lt;br /&gt;TestClass record = new TestClass( "Beam", 1.75 );&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;In the class the format of the parameters must be specified, like String and float.&lt;br /&gt;A whole bunch of records can be made like this:&lt;code&gt;&lt;br /&gt;TestClass[] namePayArray = new TestClass[20];&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;but these are empty objects at the moment, you can fill these objects using a for loop:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;for (int i = 0; i&amp;lt;20 ; i++)&lt;/code&gt;&lt;br /&gt;&lt;code&gt;{&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;//making an object: &lt;/code&gt;&lt;br /&gt;&lt;code&gt;    TestClass newtest = new TestClass("Beam" + str(i) , 2.5 + random(10) );&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;//putting this object in an array:&lt;/code&gt;&lt;br /&gt;&lt;code&gt;namePayArray[i] = newtest;&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;  } &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;First we make an object, then we fill in the object in the array.&lt;br /&gt;&lt;br /&gt;The Processing example can be found here:&lt;br /&gt;&lt;a href="http://www.contrechoc.com/crosslab/objectExample.zip"&gt;http://www.contrechoc.com/crosslab/objectExample.zip&lt;/a&gt;&lt;br /&gt;The results are printed in the debug window.&lt;br /&gt;&lt;br /&gt;An example of a useful object is the timer, a few post ago:&lt;br /&gt;&lt;a href="http://flashscriptingwonders.blogspot.com/2011/05/timer-considerations.html"&gt;http://flashscriptingwonders.blogspot.com/2011/05/timer-considerations.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Then a more elaborate class example is this interesting circle script from a few blog posts ago:&lt;a href="http://flashscriptingwonders.blogspot.com/2011/04/circle-packing-scripts.html"&gt;&lt;br /&gt;http://flashscriptingwonders.blogspot.com/2011/04/circle-packing-scripts.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here we already use the circle class.&lt;br /&gt;The question is....what to do when you want to see more hives (circle packings) at different positions?&lt;br /&gt;So the whole script of the circlepacking is placed in a different class, (and for convenience in a different tab).&lt;br /&gt;What is left is a simple main sketch with the constructor of the Hive's and the draw and the mousePressed (etc) functions:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Hive testme1;&lt;br /&gt;Hive testme2 ;&lt;br /&gt;Hive[] hiveArray = new Hive[20]; //the array is filled with "empty" objects&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;void setup(){&lt;br /&gt;size(1000,1000);&lt;br /&gt;testme1 = new Hive(250,250);&lt;br /&gt;testme2 = new Hive(550,550);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;for (int i = 0; i&amp;lt;20 ; i++){&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;Hive newtest = new Hive( int( 50 + random(1000)) , int(50 + random(1000)) ); hiveArray[i] = newtest; }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;void draw(){&lt;br /&gt;background( 255 );&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;testme1.draw();&lt;br /&gt;testme2.draw();&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;for (int i = 0; i&amp;lt;20 ; i++){&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;hiveArray[i].draw();&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;void mousePressed() {&lt;br /&gt;for (int i = 0; i&amp;lt;20 ; i++){ hiveArray[i].myMousePressed(); } } &lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;void mouseDragged() {&lt;br /&gt;for (int i = 0; i&amp;lt;20 ; i++){ hiveArray[i].myMouseDragged(); } } &lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;void mouseReleased() {&lt;br /&gt;for (int i = 0; i&amp;lt;20 ; i++){ hiveArray[i].myMouseReleased(); } } &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can find the sketch here: &lt;a href="http://www.contrechoc.com/crosslab/hiveCircleClassExample.zip"&gt;http://www.contrechoc.com/crosslab/hiveCircleClassExample.zip&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-1457280280548838792?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/1457280280548838792/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/05/making-and-using-simple-object.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/1457280280548838792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/1457280280548838792'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/05/making-and-using-simple-object.html' title='Making and using a simple Object'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-8533041102535043518</id><published>2011-05-16T06:21:00.000-07:00</published><updated>2011-05-16T06:25:18.182-07:00</updated><title type='text'>Using a PVector making a field</title><content type='html'>A vector is a point with a property of an added direction. In short: an arrow.&lt;br /&gt;Nice drawings can be made using arrows over the whole plane. But doing this by hand is tedious. So we do it by code.&lt;br /&gt;In Processing the thing to look at is a PVector.&lt;br /&gt;&lt;br /&gt;There is a nice tutorial about PVectors:&lt;br /&gt;&lt;a href="http://processing.org/learning/pvector/"&gt;http://processing.org/learning/pvector/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Vector on a plane (or in space) - when the vectors are ordered, that is vary in a "physical" way - form a so called vector field. The vectors are like hair being combed.&lt;br /&gt;&lt;br /&gt;One way to imagine a vector field is to think of magnets, the field lines, so beautifully made visible by iron dust:&lt;br /&gt;&lt;a href="http://www.openprocessing.org/visuals/?visualID=21418"&gt;http://www.openprocessing.org/visuals/?visualID=21418&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Another way is to look at fluids, waves:&lt;br /&gt;&lt;a href="http://www.openprocessing.org/visuals/?visualID=12569"&gt;http://www.openprocessing.org/visuals/?visualID=12569&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This is also a nice example:&lt;br /&gt;&lt;a href="http://www.openprocessing.org/visuals/?visualID=6707"&gt;http://www.openprocessing.org/visuals/?visualID=6707&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Or look at this one:&lt;br /&gt;&lt;a href="http://www.openprocessing.org/visuals/?visualID=27653"&gt;http://www.openprocessing.org/visuals/?visualID=27653&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;With color:&lt;br /&gt;&lt;a href="http://www.openprocessing.org/visuals/?visualID=1036"&gt;http://www.openprocessing.org/visuals/?visualID=1036&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;search on keyword "field" in OpenProcessing.org&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-8533041102535043518?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/8533041102535043518/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/05/using-pvector-making-field.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/8533041102535043518'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/8533041102535043518'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/05/using-pvector-making-field.html' title='Using a PVector making a field'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-1854726610934436847</id><published>2011-05-16T05:09:00.000-07:00</published><updated>2011-05-16T08:29:22.877-07:00</updated><title type='text'>Google search API in Processing</title><content type='html'>When you want to get a google search inside your Processing sketch:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://lowfrequency.org/interactivity/wiki/index.php?title=Google_API_In_Processing"&gt;http://lowfrequency.org/interactivity/wiki/index.php?title=Google_API_In_Processing&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;On this page there is an example:&lt;br /&gt;&lt;a href="http://lowfrequency.org/interactivity/wiki/index.php?title=GoogleJSONSearch_Example"&gt;http://lowfrequency.org/interactivity/wiki/index.php?title=GoogleJSONSearch_Example&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;which worked right away!&lt;br /&gt;&lt;br /&gt;(be careful, look at the dates of the link you find, for instance, this link:&lt;br /&gt;http://users.design.ucla.edu/~tatsuyas/tools/google/index.htm&lt;br /&gt;is from 2005 and the libraries don't work anymore.....)&lt;br /&gt;&lt;br /&gt;But that is because I already had a json.jar&lt;br /&gt;If you don't have a json.jar download this zip, which has a json.jar in the folder code in the sketch folder. Put this folder inside the Processing folder and restart Processing before running it. &lt;br /&gt;&lt;a href="http://www.contrechoc.com/crosslab/googleSearch.zip"&gt;http://www.contrechoc.com/crosslab/googleSearch.zip&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-1854726610934436847?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/1854726610934436847/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/05/google-search-api-in-processing.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/1854726610934436847'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/1854726610934436847'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/05/google-search-api-in-processing.html' title='Google search API in Processing'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-4088784858902254493</id><published>2011-05-07T13:51:00.000-07:00</published><updated>2011-05-16T02:22:46.920-07:00</updated><title type='text'>Timer considerations</title><content type='html'>This links shows how easy everything becomes in Object Oriented Programming:&lt;br /&gt;&lt;a href="http://www.learningprocessing.com/examples/chapter-10/example-10-5/"&gt;http://www.learningprocessing.com/examples/chapter-10/example-10-5/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;But this example when used with mousePressed (for example) has a flaw: the timer.isFinished() is always true when the timer is not started immediately.&lt;br /&gt;&lt;br /&gt;So we added a stop() function for the timer, and now timer.isFinished() is also false so long as the timer is not started.&lt;br /&gt;&lt;br /&gt;You can find the sketch here: &lt;a href="http://www.contrechoc.com/crosslab/timerOO/applet/timerOO.html"&gt;http://www.contrechoc.com/crosslab/timerOO/applet/timerOO.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;When you click in the sketch square you see the background change after 3 seconds.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This is a good example to see the power of objects.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-4088784858902254493?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/4088784858902254493/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/05/timer-considerations.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/4088784858902254493'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/4088784858902254493'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/05/timer-considerations.html' title='Timer considerations'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-1442921799281846900</id><published>2011-04-28T01:44:00.000-07:00</published><updated>2011-04-28T01:48:25.005-07:00</updated><title type='text'>Extended circle packing script</title><content type='html'>Here you can download a script with more properties of the circle class:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.contrechoc.com/crosslab/creativeDatabase.zip"&gt;http://www.contrechoc.com/crosslab/creativeDatabase.zip&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;The circles also have an image attached, which can be found in the datafolder of the sketch.&lt;br /&gt;Also a sound is associated with the circles, also in the datafolder.&lt;br /&gt;&lt;br /&gt;There is more interactivity:&lt;br /&gt;clicking on the circles plays the sound and enlarges the circle, for 3 seconds, and the keyboard 1,2,3,4,5 etc are active the same way.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-1442921799281846900?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/1442921799281846900/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/04/extended-circle-packing-script.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/1442921799281846900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/1442921799281846900'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/04/extended-circle-packing-script.html' title='Extended circle packing script'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-1759740919958921255</id><published>2011-04-11T05:52:00.000-07:00</published><updated>2011-04-11T06:11:40.627-07:00</updated><title type='text'>Circle packing scripts</title><content type='html'>For datavisualization you need some nice examples to start coding on:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.cricketschirping.com/processing/CirclePacking1/"&gt;http://www.cricketschirping.com/processing/CirclePacking1/&lt;/a&gt; is certainly a nice one!&lt;br /&gt;&amp;nbsp;as can be read in the script, here is an explanation:&lt;br /&gt;&lt;a href="http://wiki.mcneel.com/developer/sdksamples/2dcirclepacking"&gt;http://wiki.mcneel.com/developer/sdksamples/2dcirclepacking&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The example file has to be modified a bit, the noc library is deprecated and you can replace it with PVector:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;PVector v = new PVector(); // instead of &amp;nbsp; Vector3D v = new Vector3D();&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;The circles have a random radius, you can change this in: ArrayList createRandomCircles(int n) .....&lt;br /&gt;&lt;code&gt;&lt;br /&gt;float myRadius = 30;//this was 10 + random (30)&lt;br /&gt;Circle c = new Circle(random(width), random(height), myRadius);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;The radius is chosen for all the circles which are put in the arraylist (the return of this function)&lt;br /&gt;So here you can make the link between an array with data (for instance from the NYTimes Api examples).&lt;br /&gt;&lt;br /&gt;With&lt;code&gt;&lt;br /&gt;text( "hello", (int)x, (int)y );&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;in the circle class:&lt;code&gt;&lt;br /&gt;&amp;nbsp; public void draw() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fill(myColor);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; stroke(myColor);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; strokeWeight(3);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ellipse((int)x, (int)y, (int)radius*2, (int)radius*2);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; text( "hello", (int)x, (int)y );&lt;br /&gt;&amp;nbsp; }&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;you can add a text to the circles. This text is static at the moment, but could come from an array of names of countries...&lt;br /&gt;&lt;br /&gt;Here is this modified version of the script:&lt;br /&gt;&lt;a href="http://www.contrechoc.com/crosslab/circlePacking.zip"&gt;http://www.contrechoc.com/crosslab/circlePacking.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;(Thx to Martijn, who found this script.)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;other circle scripts can be found here:&lt;br /&gt;&lt;a href="http://www.openprocessing.org/visuals/?visualID=11727"&gt;http://www.openprocessing.org/visuals/?visualID=11727&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-1759740919958921255?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/1759740919958921255/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/04/circle-packing-scripts.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/1759740919958921255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/1759740919958921255'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/04/circle-packing-scripts.html' title='Circle packing scripts'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-1545402068418608274</id><published>2011-04-04T03:29:00.000-07:00</published><updated>2011-04-04T03:39:50.090-07:00</updated><title type='text'>Processing XML example</title><content type='html'>Working with XML is not too difficult if you know how to handle this format. To study here a simple example:&lt;br /&gt;&lt;br /&gt;A XML is constructed and is read in the sketch.&lt;br /&gt;You can follow the tree structure easily. More elaborate XML files are in principle the same.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;This is the xml file:&lt;/code&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-TVL1SJGYxlE/TZmfycB4e9I/AAAAAAAABZI/UZfkwaFHgko/s1600/xml.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-TVL1SJGYxlE/TZmfycB4e9I/AAAAAAAABZI/UZfkwaFHgko/s1600/xml.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;the xml file can be found in the link and is situated in the sketch folder&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;XMLElement xml;&lt;br /&gt;&lt;br /&gt;void setup(){&lt;br /&gt;&lt;br /&gt;//loading the file&lt;br /&gt;&lt;br /&gt;xml = new XMLElement(this, "xmlExample.xml");&lt;br /&gt;&lt;br /&gt;//printing: look at the file structure&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;println(  xml );&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//get the first part of the upper branch&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;XMLElement myChannel = xml.getChild(0);&lt;br /&gt;&lt;br /&gt;println(  myChannel );&lt;br /&gt;&lt;br /&gt;//now we will look at all the parts of the upper branch&lt;br /&gt;&lt;br /&gt;int childCount = xml.getChildCount();&lt;br /&gt;&lt;br /&gt;for (int i=0; i&amp;lt; childCount ; i++ ){&lt;br /&gt;XMLElement countPart = xml.getChild(i);&lt;br /&gt;println(  countPart );&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//we will print the text parts, but these are still xml elements&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;for (int i=0; i&amp;lt; childCount ; i++ ){&lt;br /&gt;XMLElement countPart = xml.getChild(i);&lt;br /&gt;XMLElement insidePart = countPart.getChild(0);//this is still inserted between text tags &lt;br /&gt;println(  insidePart );&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;//to get the text itself we have to ask for the content:&lt;br /&gt;&lt;br /&gt;for (int i=0; i&amp;lt; childCount ; i++ ){&lt;br /&gt;XMLElement countPart = xml.getChild(i);&lt;br /&gt;XMLElement textPart = countPart.getChild(0);//you see that this can also be an array&lt;br /&gt;String insidePart = textPart.getContent();&lt;br /&gt;&lt;br /&gt;println(  insidePart );&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;void draw(){&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;download this project as a sketch: &lt;a href="http://www.contrechoc.com/crosslab/xmlExample.zip"&gt;http://www.contrechoc.com/crosslab/xmlExample.zip&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-1545402068418608274?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/1545402068418608274/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/04/processing-xml-example.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/1545402068418608274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/1545402068418608274'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/04/processing-xml-example.html' title='Processing XML example'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-TVL1SJGYxlE/TZmfycB4e9I/AAAAAAAABZI/UZfkwaFHgko/s72-c/xml.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-2157870546110109795</id><published>2011-04-03T11:54:00.000-07:00</published><updated>2011-04-11T05:59:15.295-07:00</updated><title type='text'>Processing NYTimes API and JSON</title><content type='html'>Ok, just when you think you know XML, there is an API using JSON.&lt;br /&gt;This is always so sad! But luckily some people have compassion and solved our problems:&lt;br /&gt;&lt;a href="http://blog.blprnt.com/blog/blprnt/processing-json-the-new-york-times"&gt;http://blog.blprnt.com/blog/blprnt/processing-json-the-new-york-times&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Following this blogpost, we can extract numbers from articles, and there is even a simple way to visualize the data.&lt;br /&gt;&lt;br /&gt;Analyzing the JSON String:&lt;br /&gt;&lt;br /&gt;when we get the full JSON file we see these parts:&lt;br /&gt;&lt;br /&gt;{"body" : "Music CITY HALL COFFEE HOUSE The \"Rockin' the Courtroom\" musical series kicks off with Scott E. Moore, singer and guitarist, and Frank Bango, singer. Friday at 7 P.M. Tickets: $5. Next week, Caren Belle and Happy Boy. Hoboken City Hall, 94 Washington Street, Hoboken. (201) 420-2207. CLUB BENE Female impersonators take the stage in \"Boys Will Be" , "date" : "19951231" , "title" : "ON THE TOWNS" , "url" : "http:\/\/www.nytimes.com\/1995\/12\/31\/nyregion\/on-the-towns-050180.html"}&lt;br /&gt;&lt;br /&gt;and other pieces that start with "body".&lt;br /&gt;&lt;br /&gt;We also see that \" is used for quotes, and inside the body the main text is seperated from the date by a comma.&lt;br /&gt;&lt;br /&gt;So we can use some String functions to extract the text from the results like this:&lt;br /&gt;&lt;br /&gt;String request = baseURL + "?query=O.J.+Simpson&amp;amp;begin_date=19940101&amp;amp;end_date=19960101&amp;amp;api-key=" + apiKey;&lt;br /&gt;&lt;br /&gt;String result = join( loadStrings( request ), "");&lt;br /&gt;&lt;br /&gt;//println( result );&lt;br /&gt;&lt;br /&gt;String[] resultList = split(result, "body");&lt;br /&gt;&lt;br /&gt;for (int i = 0;i&amp;lt; resultList.length;i++){&lt;br /&gt;//remove 5 front chars&lt;br /&gt;String removeFrontSpaces = resultList[i].substring(5, resultList[i].length() );&lt;br /&gt;//search for date and stop the string in front&lt;br /&gt;int dateIndex = removeFrontSpaces.indexOf("date");&lt;br /&gt;String resultWithoutDate = removeFrontSpaces.substring( 0, max ( dateIndex - 2, 0)  );&lt;br /&gt;//println (resultList[i] );// has " : " in front&lt;br /&gt;//println (removeFrontSpaces );&lt;br /&gt;println( resultWithoutDate );&lt;br /&gt;println ("------------------------------");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Looking at the text, you can see "byline" as an indicator, this can be removed (if you want to) in the same way as date. You could also start the splitting at date and get the date out.&lt;br /&gt;&lt;br /&gt;Here are the first few results:&lt;br /&gt;&lt;br /&gt;------------------------------&lt;br /&gt;Music CITY HALL COFFEE HOUSE The \"Rockin' the Courtroom\" musical series kicks off with Scott E. Moore, singer and guitarist, and Frank Bango, singer. Friday at 7 P.M. Tickets: $5. Next week, Caren Belle and Happy Boy. Hoboken City Hall, 94 Washington Street, Hoboken. (201) 420-2207. CLUB BENE Female impersonators take the stage in \"Boys Will Be" ,&lt;br /&gt;------------------------------&lt;br /&gt;They have sportcoats, E-mail and no suntan. Northwestern will not be playing its look-alike in the Rose Bowl; Harvard isn't eligible. The Wildcats are here for the first time in a half-century, thanks to either running back Darnell Autry or their longtime alum, Moses. A year ago this week, one of their leading tacklers was giving Penn State a" , "byline" : "By TOM FRIEND" ,&lt;br /&gt;------------------------------&lt;br /&gt;and so on...&lt;br /&gt;&lt;br /&gt;Remark, often running the sketch, you get a NullPointerException, the request is not returned. This happens even if you use try catch structures. Just try a few times, the API must be very busy!&lt;br /&gt;&lt;br /&gt;Roxane Torre has made this pdf with very useful info and exmples:&lt;br /&gt;&lt;a href="http://crosslabminor.files.wordpress.com/2011/04/dag32.pdf"&gt;http://crosslabminor.files.wordpress.com/2011/04/dag32.pdf&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-2157870546110109795?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/2157870546110109795/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/04/processing-nytimes-api-and-json.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/2157870546110109795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/2157870546110109795'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/04/processing-nytimes-api-and-json.html' title='Processing NYTimes API and JSON'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-327695386383539075</id><published>2011-04-02T22:50:00.000-07:00</published><updated>2011-04-03T12:09:17.750-07:00</updated><title type='text'>Twitter XML structure</title><content type='html'>If we want to get the tweets from the twitterrequest we have to understand the structure of the XML twitter is sending us.&lt;br /&gt;Here is an example of a "live" xml: &lt;a href="http://api.twitter.com/1/statuses/user_timeline.xml?user_id=111370674"&gt;http://api.twitter.com/1/statuses/user_timeline.xml?user_id=111370674&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This is one XML request saved: &lt;a href="http://www.contrechoc.com/crosslab/user_timeline.xml/"&gt;user_timeline.xml&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Processing reference: &lt;a href="http://processing.org/reference/XMLElement.html"&gt;http://processing.org/reference/XMLElement.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Referring back to the processing script in one of the former posts we see this:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;XMLElement   xml = new XMLElement(this, "http://twitter.com/statuses/user_timeline/8138312.rss");&lt;br /&gt;&lt;br /&gt;//we can dive into the XML tree with the getChild();&lt;br /&gt;&lt;br /&gt;XMLElement myChannel = xml.getChild(0);&lt;br /&gt;&lt;br /&gt;//with getChild you can count the "nodes"&lt;br /&gt;&lt;br /&gt;XMLElement[] tweets = myChannel.getChildren("item");&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;with getChildren , you can search on the "name" of the t&lt;br /&gt;ag, getting back an array: XMLElement array, for this you have to know the name of the array. In this case the name is "item" .&lt;br /&gt;&lt;br /&gt;Then you get the node 0 of this "item", and ask for the content:&lt;br /&gt;tweets[i].getChild(0).getContent();&lt;br /&gt;&lt;br /&gt;(which are the tweet texts) these are Strings, so pieces of text.&lt;br /&gt;&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Remark, you can only do 150 request an hour to get tweets from one client (say a computer) So real time twitter streaming, showing new tweets immediately is not possible. Also gaming with extracting commands from tweets is too slow now.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-327695386383539075?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/327695386383539075/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/04/twitter-xml-structure.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/327695386383539075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/327695386383539075'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/04/twitter-xml-structure.html' title='Twitter XML structure'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-541181743742627974</id><published>2011-04-02T12:57:00.000-07:00</published><updated>2011-04-02T12:57:19.460-07:00</updated><title type='text'>Processing Twitter update</title><content type='html'>See the post about twitter.&lt;br /&gt;&lt;br /&gt;We would like to put the XML inside the draw function, to get fresh tweets and do something with these tweets. The problem is the request rate: if you exceed the limit of 150 an hour (on a computer, called the client) you get an error:&lt;br /&gt;&lt;br /&gt;&amp;lt;hash&amp;gt;&lt;br /&gt;&amp;lt;request&amp;gt;/1/statuses/user_timeline.xml?user_id=111370675&amp;lt;/request&amp;gt;&lt;br /&gt;−&lt;br /&gt;&amp;lt;error&amp;gt;&lt;br /&gt;Rate limit exceeded. Clients may not make more than 150 requests per hour.&lt;br /&gt;&amp;lt;/error&amp;gt;&lt;br /&gt;&amp;lt;/hash&amp;gt;&lt;br /&gt;&lt;br /&gt;So 2 times a minute should be possible?&lt;br /&gt;Which means steering something around using tweets is too slow.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-541181743742627974?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/541181743742627974/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/04/processing-twitter-update.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/541181743742627974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/541181743742627974'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/04/processing-twitter-update.html' title='Processing Twitter update'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-2715622190309034926</id><published>2011-03-20T11:55:00.000-07:00</published><updated>2011-03-21T07:24:29.238-07:00</updated><title type='text'>Text research</title><content type='html'>In database visualisation we can have a dataset which consists of numbers or of text.&lt;br /&gt;In case of numbers we can easily do some graphics. Text is more versatile, but coding properties of text requires a bit of knowledge of the functions around Strings.&lt;br /&gt;A wonderful text and string tutorial is found here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://processing.org/learning/text/"&gt;http://processing.org/learning/text/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;possibly we also need to know the pixel position of a word in a piece of text:&lt;br /&gt;we start searching the position of the word, indicating the character number, if the word is found, &lt;br /&gt;&lt;code&gt;String myText = "we always cry out for love";&lt;br /&gt;int lovePosition = myText.indexOf("love");//indexOf is the JAVA function&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;then to have the word "love" made special, colored or bold, we can use the tricks mentioned in this link using textWidth, looping through the string, with charAt.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-2715622190309034926?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/2715622190309034926/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/03/text-research.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/2715622190309034926'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/2715622190309034926'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/03/text-research.html' title='Text research'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-2179850839623612881</id><published>2011-03-05T11:18:00.000-08:00</published><updated>2011-03-05T11:18:08.861-08:00</updated><title type='text'>String functions</title><content type='html'>Loaded data, from a file or a spreadsheet can be in numbers, or in text.&lt;br /&gt;When working with text you have to know about the functions which can manipulate text.&lt;br /&gt;Say we have the text&lt;br /&gt;&lt;code&gt;&lt;br /&gt;String hString = `Hello world and especially during carnaval`&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;And we want to have the seperated words in a list&lt;br /&gt;&lt;code&gt;&lt;br /&gt;String hString = "tester and rester";&lt;br /&gt;String[] StringElements = split(hString,  " ");&lt;br /&gt;for (int i =0; i&amp;lt;  StringElements.length ;i++)     println(   StringElements[i] );      &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;we have the function split this gives an array which as elements the words if you use the space as a delimiter.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;String hString = "tester";&lt;br /&gt;println( hString.length());&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;To find a specific word the function indexOf is used&lt;br /&gt;&lt;code&gt;&lt;br /&gt;String hString = "tester";&lt;br /&gt;println( hString.indexOf("ster"));&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This can be useful extraction words from a twitterstream and doing something with these special words.&lt;br /&gt;&amp;nbsp;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-2179850839623612881?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/2179850839623612881/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/03/string-functions.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/2179850839623612881'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/2179850839623612881'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/03/string-functions.html' title='String functions'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-8383430985722636677</id><published>2011-03-05T10:59:00.000-08:00</published><updated>2011-03-05T10:59:30.738-08:00</updated><title type='text'>Reading data from an excell document</title><content type='html'>Lots of data are given in a spreadsheet.&lt;br /&gt;&lt;br /&gt;To read a excell sheet we use a library, which comes from a third party&lt;br /&gt;XlsReader-0.1.0, &lt;a href="http://bezier.de/processing/libs/xls/"&gt;http://bezier.de/processing/libs/xls/&lt;/a&gt;&lt;br /&gt;You have to download this library and put it in the right spot, so that Processing can find it.&lt;br /&gt;This is the folder libraries in the Processing folder. In MACOS you have to select the Processing application and ask for the folders contained in it.&lt;br /&gt;Rename the folder in the folder libraries: XlsReader.&lt;br /&gt;Then you can try out an example in the example folder in this folder XlsReader.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;import de.bezier.data.*;&lt;br /&gt;&lt;br /&gt;XlsReader reader;&lt;br /&gt;&lt;br /&gt;int c = 0;&lt;br /&gt;&lt;br /&gt;PFont fontA;&lt;br /&gt;&lt;br /&gt;void setup ()&lt;br /&gt;{&lt;br /&gt;size (300,100);&lt;br /&gt;reader = new XlsReader( this, "workbook.xls" );    // assumes file to be in the data folder&lt;br /&gt;&lt;br /&gt;fontA = loadFont("LucidaBright-Demi-18.vlw");&lt;br /&gt;textFont(fontA, 32);&lt;br /&gt;&lt;br /&gt;frameRate(3);&lt;br /&gt;loop();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void draw(){&lt;br /&gt;c++;&lt;br /&gt;fill(0,36);&lt;br /&gt;text(   reader.getString( 1 + c%3, 0 ) , 10 + random(150), 50  + (c%3)*20 );&lt;br /&gt;println(   reader.getString( 1 + c%3, 0 )   );&lt;br /&gt;stroke(155);&lt;br /&gt;if ( c&amp;gt;5 ) { fill(200); rect(0,0,300,100);c=0; }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This sketch uses a .xls sheet having three words: ship, u-boat and ufo&lt;br /&gt;&lt;br /&gt;&lt;code&gt;  reader.getString(x,y ) just reads the value in the cell, x y.&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;For a number use: &lt;/code&gt;&lt;code&gt;reader.getInt(x,y ) or &lt;/code&gt;&lt;code&gt;reader.getFloat(x,y )&lt;/code&gt;&lt;br /&gt;&lt;code&gt;That is all there is!&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh3.googleusercontent.com/-ndoCWPJJiLg/TXKHuepjIHI/AAAAAAAABY8/pV7zJKrnCo4/s1600/ufo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://lh3.googleusercontent.com/-ndoCWPJJiLg/TXKHuepjIHI/AAAAAAAABY8/pV7zJKrnCo4/s1600/ufo.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;Of course numbers in the spreadsheet can be used to position an image, or move an image around.&lt;/code&gt;&lt;code&gt; &lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-8383430985722636677?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/8383430985722636677/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/03/reading-data-from-excell-document.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/8383430985722636677'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/8383430985722636677'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/03/reading-data-from-excell-document.html' title='Reading data from an excell document'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='https://lh3.googleusercontent.com/-ndoCWPJJiLg/TXKHuepjIHI/AAAAAAAABY8/pV7zJKrnCo4/s72-c/ufo.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-958412965831456984</id><published>2011-03-05T10:36:00.000-08:00</published><updated>2011-03-05T10:36:59.282-08:00</updated><title type='text'>Loading data into arrays</title><content type='html'>This time we will look at how to load external data into our Processing sketch.&lt;br /&gt;Look at the example LoadFile1 in menu-&amp;gt;examples-&amp;gt;topics FileIO&lt;br /&gt;&lt;br /&gt;FileIO means input / output of files.&lt;br /&gt;&lt;br /&gt;A text file is a collection of text, chars, numbers.&lt;br /&gt;To read a file automatically we need to know how the data in the file is formatted.&lt;br /&gt;&lt;br /&gt;Seperation can be newline, space, comma.&lt;br /&gt;&lt;br /&gt;We will explore different techniques to get the numbers out of the file.&lt;br /&gt;&lt;br /&gt;Maybe we can read the data in, but have to store them in a special way. Then we make our own "class". The class being an abstract structure.&lt;br /&gt;&lt;br /&gt;An example Class can be a record of a name and an age.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;class Record {&lt;br /&gt;String name;&lt;br /&gt;int age;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;every time we do&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Record person1 = new Record ( "Karel de Grote", 44 );&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;So we store age and name in this "record".&lt;br /&gt;We can also make arrays of these Records:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Record[] persons = new Record [50];&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now we can store 50 of these persons.&lt;br /&gt;&lt;br /&gt;Much more complex Classes can be made the same way.&lt;br /&gt;&lt;br /&gt;The most used way nowadays to format data is XML.&lt;br /&gt;Processing has an datastructure called XMLElement.&lt;br /&gt;See this page:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://processing.org/reference/XMLElement.html"&gt;http://processing.org/reference/XMLElement.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;With XML we can get the data from for instance twitter and display the tweets as text.&lt;br /&gt;&lt;br /&gt;See this former post about that:&lt;br /&gt;&lt;a href="http://flashscriptingwonders.blogspot.com/2011/01/processing-and-twitter.html"&gt;http://flashscriptingwonders.blogspot.com/2011/01/processing-and-twitter.html&amp;nbsp;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A minimal XML example can be found here:&lt;br /&gt;&lt;a href="http://www.learningprocessing.com/tutorials/simpleML/"&gt;http://www.learningprocessing.com/tutorials/simpleML/&amp;nbsp;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This is a library for doing yahoo searches:&lt;br /&gt;&lt;a href="http://www.learningprocessing.com/tutorials/yahoo/"&gt;http://www.learningprocessing.com/tutorials/yahoo/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-958412965831456984?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/958412965831456984/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/03/loading-data-into-arrays.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/958412965831456984'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/958412965831456984'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/03/loading-data-into-arrays.html' title='Loading data into arrays'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-2401930860281673600</id><published>2011-02-19T22:54:00.000-08:00</published><updated>2011-02-20T22:51:49.999-08:00</updated><title type='text'>Data in Array - basics</title><content type='html'>We will expand our drawing capabilities, and meet lots of tricks on the way. First two ways to make a list of data. With a list, called an array, we avoid having to give names to each data individually. We kan collect the data in the array and get them in our drawing by calling an element: data[elementNumber]. Mind the square brackets. Also do remember the first element is 0 (zero) and not one.&lt;br /&gt;&lt;br /&gt;There are two ways of declaring an array, without, or with the elements.&lt;br /&gt;&lt;br /&gt;Main example:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;//---------------------------------&lt;br /&gt;//-------declarations-----------&lt;br /&gt;//---------------------------------&lt;br /&gt;int numberOfElements = 10;&lt;br /&gt;int[] data1 = new int[numberOfElements];//making data automatically&lt;br /&gt;int[] data2 = { 7,3,6,34,2,34,5,6,87,33 };//making data by hand&lt;br /&gt;//---------------------------------&lt;br /&gt;//------setup------------&lt;br /&gt;//---------------------------------&lt;br /&gt;void setup() {&lt;br /&gt;size(320, 240);&lt;br /&gt;background(176);&lt;br /&gt;stroke(10);&lt;br /&gt;line(5,5, 315, 5);&lt;br /&gt;line(315, 5, 315, 235);&lt;br /&gt;line(315, 235, 5, 235);&lt;br /&gt;line(5 , 235, 5,5);&lt;br /&gt;//---------------------------------&lt;br /&gt;//making data automatically (could also be loading the data from an external source)&lt;br /&gt;for (int i = 0; i &amp;lt; numberOfElements; i++)&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;{&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;data1[i] = i*10;&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;  }&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;}&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;//---------------------------------&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;//--------draw-------------&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;//---------------------------------&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;void draw() {&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;for (int i = 0; i &amp;lt; numberOfElements; i++ )&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;   {&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;//-----------data1----------------&amp;nbsp;&lt;/code&gt;&lt;code&gt; &lt;/code&gt;&lt;br /&gt;&lt;code&gt;      strokeWeight(1);//make a thin line&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;     stroke(0);&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;    line(i*20, 160, i*20, 160 - data1[i] );&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;//----------data2-----------------&amp;nbsp;&lt;/code&gt;&lt;code&gt; &lt;/code&gt;&lt;br /&gt;&lt;code&gt;strokeWeight(4);//make a thick line&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;    stroke(100);//grey colored&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;     line(i*20, 160, i*20, 160 +  data2[i] );&lt;/code&gt;&lt;br /&gt;&lt;code&gt;    }&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt; }&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Then we add some tricks, like making different drawing on keyinput, using a "showmode variable" and keypressed, see former post.&lt;br /&gt;&lt;br /&gt;Then we add some images to the drawing of the data, for instance as a background, or accompanying the individual data using:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;PImage b;&lt;br /&gt;b = loadImage("someBackground.jpg");&lt;br /&gt;image(b, 0, 0);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Then we add some typography, to indicate the individual data or to give our masterpiece a title:&lt;br /&gt;For this we create a font in our sketchfolder using menu-&amp;gt;tools-&amp;gt;create font.&lt;br /&gt;&lt;br /&gt;You can get the whole example here:&lt;br /&gt;&lt;a href="http://www.contrechoc.com/crosslab/data2_arrays.zip"&gt;www.contrechoc.com/crosslab/data2_arrays.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Tutorials about Processing are very abundant, this one i came across looking for the rotation of a text:&lt;br /&gt;&lt;a href="http://www.learningprocessing.com/examples/chapter-17/example-17-5-rotating-text/"&gt;http://www.learningprocessing.com/examples/chapter-17/example-17-5-rotating-text/ &lt;/a&gt;&lt;br /&gt;But this one rotates the whole canvas.&lt;br /&gt;To rotate only a bit of the text you have to separate the textbit from the rest of the canvas by&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;pushmatrix();&lt;br /&gt;rotate(.01);//parameter in radians&lt;br /&gt;textFont(f); &lt;br /&gt;popmatrix();&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The pushmatrix and the popmatrix isolate the bit within from the canvas as a whole.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-2401930860281673600?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/2401930860281673600/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/02/data-in-array-basics.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/2401930860281673600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/2401930860281673600'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/02/data-in-array-basics.html' title='Data in Array - basics'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-2399632167305111895</id><published>2011-02-17T05:20:00.000-08:00</published><updated>2011-02-17T05:27:57.093-08:00</updated><title type='text'>Array wonders</title><content type='html'>We start with the ARRAYS from the section learning of the Processing tutorials.&lt;br /&gt;We slightly modify the example:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;// Example: 2D Array&lt;br /&gt;size(400,400);&lt;br /&gt;int cols = 5;&lt;br /&gt;int rows = 5;&lt;br /&gt;// Declare 2D array&lt;br /&gt;int[][] myArray = new int[cols][rows];&lt;br /&gt;int cellWidthHeight = 80;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;int &lt;/code&gt;&lt;code&gt;showMode = 0;//see later on&lt;/code&gt;&lt;br /&gt;&lt;code&gt; //&lt;br /&gt;void setup(){&lt;br /&gt;// Initialize 2D array values RANDOM&lt;br /&gt;for (int i = 0; i &amp;lt; cols; i++)&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;{   &lt;br /&gt;for (int j = 0; j &amp;lt; rows; j++) &lt;br /&gt;{     &lt;br /&gt;myArray[i][j] = int(random(255));   &lt;br /&gt;} &lt;br /&gt;} &lt;br /&gt;} &lt;br /&gt;// &lt;br /&gt;void draw(){&lt;br /&gt;// Draw points &lt;br /&gt;for (int i = 0; i &amp;lt; cols; i++) &lt;br /&gt;{   &lt;br /&gt;for (int j = 0; j &amp;lt; rows; j++) &lt;br /&gt;{     &lt;br /&gt;fill(myArray[i][j]);     &lt;br /&gt;rect(i*cellWidthHeight, j*cellWidthHeight,cellWidthHeight,cellWidthHeight);     point(i,j);   &lt;br /&gt;} &lt;br /&gt;} &lt;br /&gt;} &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;But we see only one representation, 2D, we would like to see more perspectives, for instance on a line, or on a circle.&lt;br /&gt;For this we make showModes, and depending on a showmode the view should change.&lt;br /&gt;We make the keys of the keyboard interactive and use keypressed to choose a mode:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;void keyPressed() {&lt;br /&gt;&amp;nbsp;if ( key == 1 ) showMode = 1;&lt;br /&gt;&amp;nbsp;if ( key == 2 ) showMode = 2;&lt;br /&gt;&amp;nbsp;&lt;/code&gt;&lt;code&gt;if ( key == 3 ) showMode = 3;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;like that we can swith between "perspectives" of the same data. &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;void draw(){&lt;/code&gt;&lt;br /&gt;&lt;code&gt;if ( showMode == 1 ){&lt;br /&gt;// Draw points &lt;br /&gt;for (int i = 0; i &amp;lt; cols; i++) &lt;br /&gt;{   &lt;br /&gt;for (int j = 0; j &amp;lt; rows; j++) &lt;br /&gt;{     &lt;br /&gt;fill(myArray[i][j]);     &lt;br /&gt;rect(i*cellWidthHeight,  j*cellWidthHeight,cellWidthHeight,cellWidthHeight);     point(i,j);   &lt;br /&gt;} &lt;br /&gt;}&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;}&lt;/code&gt;&lt;br /&gt;&lt;code&gt;if ( showMode == 2 ){&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;//do something else&lt;/code&gt;&lt;br /&gt;&lt;code&gt;}&lt;/code&gt;&lt;br /&gt;&lt;code&gt; &lt;/code&gt;&lt;br /&gt;&lt;code&gt;if ( showMode == 3 ){&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;//do something else&lt;/code&gt;&lt;br /&gt;&lt;code&gt;}&lt;/code&gt;&lt;br /&gt;&lt;code&gt; }&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now we can play around in diffeent primitive visualisations of the data.&lt;br /&gt;source code: &lt;a href="http://www.contrechoc.com/crosslab/array.pde"&gt;http://www.contrechoc.com/crosslab/array.pde&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-FRW1xj7PTSo/TV0iVFP_9-I/AAAAAAAABY4/eaHNXu5ikmY/s1600/arrayblog.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="116" src="http://1.bp.blogspot.com/-FRW1xj7PTSo/TV0iVFP_9-I/AAAAAAAABY4/eaHNXu5ikmY/s320/arrayblog.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-2399632167305111895?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/2399632167305111895/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/02/array-wonders.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/2399632167305111895'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/2399632167305111895'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/02/array-wonders.html' title='Array wonders'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-FRW1xj7PTSo/TV0iVFP_9-I/AAAAAAAABY4/eaHNXu5ikmY/s72-c/arrayblog.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-3073404261917470344</id><published>2011-02-13T22:25:00.000-08:00</published><updated>2011-02-13T22:30:40.701-08:00</updated><title type='text'>Starting with Processing</title><content type='html'>&lt;h4&gt;&lt;span class="mw-headline"&gt; Dude, Where's the Timeline? This Sucks… / Awesome! A Flash Killer! &lt;/span&gt;&lt;/h4&gt;We're not targeting the same audience Flash. If we wanted to make a  Flash killer, we'd have set out to do that and our stated purpose would  have been more specific.....&lt;br /&gt;&lt;br /&gt;see: &lt;a href="http://wiki.processing.org/w/FAQ"&gt;http://wiki.processing.org/w/FAQ &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So we will explore PROCESSING.....&lt;br /&gt;&lt;a href="http://www.processing.org/"&gt;http://www.processing.org/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;take a look at the tutorials, under the tab learning, explore&lt;br /&gt;&lt;a href="http://www.processing.org/learning/drawing"&gt;Coordinate System and Shapes&lt;/a&gt;&lt;br /&gt;the array examples in the Processing Programming Window&lt;br /&gt;then&lt;br /&gt;&lt;a href="http://www.processing.org/learning/2darray"&gt;Two-Dimensional Arrays&lt;/a&gt;&lt;br /&gt;and start with learning to draw&lt;br /&gt;&lt;a href="http://www.processing.org/learning/overview"&gt;Overview&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;then start programming yourself!&lt;br /&gt;&lt;br /&gt;Since we have collected data this week, we need to know what an array is  and how to plot this array using the most simple techniques of making a  line......&lt;br /&gt;&lt;br /&gt;This is my very first masterpiece: landscaping by lines: &lt;br /&gt;&lt;code&gt;&lt;br /&gt;void setup() {&lt;br /&gt;size(320, 240);&lt;br /&gt;background(176);&lt;br /&gt;stroke(10);&lt;br /&gt;line(5,5, 315, 5);&lt;br /&gt;line(315, 5, 315, 235);&lt;br /&gt;line(315, 235, 5, 235);&lt;br /&gt;line(5 , 235, 5,5);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void draw() {&lt;br /&gt;for (int i = 5; i &amp;lt; 315; i+=6)&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;{&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;float cosWave = 50* cos(float(i)/20*PI);&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;     line(i, 160, i, 160 - i/3 );&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;     line(i+ 2, 80, i+2, 80 + i/3 );&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;     line(i+ 4, 80, i+4, 160 -cosWave );&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;  }&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;} &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-ne4PLsrHJbU/TVjL4KvNJmI/AAAAAAAABYs/uB4Ra01oc6Q/s1600/landscaping.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/-ne4PLsrHJbU/TVjL4KvNJmI/AAAAAAAABYs/uB4Ra01oc6Q/s320/landscaping.jpg" width="267" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-3073404261917470344?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/3073404261917470344/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/02/starting-with-processing.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/3073404261917470344'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/3073404261917470344'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/02/starting-with-processing.html' title='Starting with Processing'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-ne4PLsrHJbU/TVjL4KvNJmI/AAAAAAAABYs/uB4Ra01oc6Q/s72-c/landscaping.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-8883759950808464317</id><published>2011-01-31T07:53:00.000-08:00</published><updated>2011-03-20T11:30:11.069-07:00</updated><title type='text'>Processing and Twitter</title><content type='html'>Of course, just when twitter is working in Flash, somebody wants it in Processing.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://tinkerlondon.com/now/2010/09/14/oauth-twitter-and-processing/"&gt;http://tinkerlondon.com/now/2010/09/14/oauth-twitter-and-processing/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://twitter4j.org/en/index.html#download"&gt;http://twitter4j.org/en/index.html#download&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The most difficult thing is to get the Processing lib right (wrong?).&amp;nbsp; &lt;br /&gt;&lt;br /&gt;But do we really need this?&lt;br /&gt;Couldn't we call the same PHP file we used in the last FLASH script?&lt;br /&gt;&lt;br /&gt;Better still, there is XMLElement in Processing:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;XMLElement xml;&lt;br /&gt;&lt;br /&gt;void setup() {&lt;br /&gt;size(800, 480);&lt;br /&gt;xml = new XMLElement(this, "http://twitter.com/statuses/user_timeline/111370674.rss");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void draw() {&lt;br /&gt;&lt;br /&gt;println( " number of xml children " + xml.getChildCount()  );&lt;br /&gt;&lt;br /&gt;XMLElement myChannel = xml.getChild(0);&lt;br /&gt;println( " number of xml children " + myChannel.getChildCount()  );&lt;br /&gt;&lt;br /&gt;XMLElement[] tweets = myChannel.getChildren("item");&lt;br /&gt;&lt;br /&gt;for (int i = 0; i &amp;lt; tweets.length; i++) {         fill(0);         textSize(9);&lt;/code&gt;&lt;br /&gt;&lt;code&gt;                 println(i + " " + tweets[i].getChild(0) );&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;                text( tweets[i].getChild(0).getContent() , 10, 20 + i*30);&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;}       noLoop();&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;}  &lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-8883759950808464317?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/8883759950808464317/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/01/processing-and-twitter.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/8883759950808464317'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/8883759950808464317'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/01/processing-and-twitter.html' title='Processing and Twitter'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-7695305645306302095</id><published>2011-01-16T21:45:00.000-08:00</published><updated>2011-03-25T06:34:57.308-07:00</updated><title type='text'>Twitter in FLASH (using OAUTH)</title><content type='html'>Twitter and Flash, twitter in your FLASH movie, getting the tweets, catching some significant words and provoke a FLASH movie reaction to your tweets....&lt;br /&gt;&lt;br /&gt;Getting your twitter timeline is just using the rssfeed of your twitter account, for example contrechoc tweets:&lt;br /&gt;&lt;a href="http://www.contrechoc.com/crosslab/twitterRSS/twitter.php"&gt;http://www.contrechoc.com/crosslab/twitterRSS/twitter.php&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;a PHP file which consists of:&lt;br /&gt;$twitterFeed = 'http://twitter.com/statuses/user_timeline/111370674.rss';&lt;br /&gt;$outputFeed = @file_get_contents($twitterFeed);&lt;br /&gt;print $outputFeed;&lt;br /&gt;&lt;br /&gt;so the most important line is&lt;br /&gt;&lt;a href="http://twitter.com/statuses/user_timeline/111370674.rss"&gt;http://twitter.com/statuses/user_timeline/111370674.rss&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;everyone can do this, you can get your twitter number here:&lt;br /&gt;&lt;a href="http://support.twitter.com/articles/15361-how-to-find-your-rss-feed"&gt;http://api.twitter.com/1/users/show.xml?screen_name=contrechoc&lt;/a&gt;&lt;br /&gt;instead of contrechoc, put your own twittername.&lt;br /&gt;or use:&lt;br /&gt;&lt;a href="http://idfromuser.com/"&gt;http://idfromuser.com&lt;/a&gt; to get your twitter unique key.&lt;br /&gt;Then you see the number above the name line. (This page is also a nice example of XML.)&lt;br /&gt;This page gives simple examples how to use twitter data on your site using php:&lt;br /&gt;&lt;a href="http://www.problogdesign.com/wordpress/how-to-get-your-twitter-follower-number-in-plain-text/"&gt;http://www.problogdesign.com/wordpress/how-to-get-your-twitter-follower-number-in-plain-text/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;More difficult is making a tweet.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Some special twitter vocabulary:&lt;br /&gt;Sending a tweet is called "Updating status". Getting the tweets is called: "Getting Timeline". Then there is: "Sending and receiving direct messages".&lt;br /&gt;&lt;br /&gt;For these acctions to be programmed we need to log in into our twitter account, which was rather easy some time ago.  The script for this, often done by a programmer,  needed to incorporate the login and password. But this was giving your credentials away, letting your password lying around on a desk of somebody else.&lt;br /&gt;&lt;br /&gt;Nowadays the script can be made without giving away your credentials using OAUTH. But this security makes life much more complex.&lt;br /&gt;&lt;br /&gt;We have to know a little bit about OAUTH, which cannot be done using FLASH. We need a PHP library as an intermediate between the "database" Twitter and our FLASH movie.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is OAUTH?&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&lt;a href="http://dev.twitter.com/pages/oauth_faq"&gt;http://dev.twitter.com/pages/oauth_faq&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;On this page there is an example illustrating the steps to get an app functioning with OAUTH:&lt;br /&gt;&lt;a href="http://blogs.sitepoint.com/2010/08/17/oauth-explained-with-foursquar/"&gt;http://blogs.sitepoint.com/2010/08/17/oauth-explained-with-foursquar/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Go to &lt;a href="http://foursquare.com/"&gt;http://foursquare.com/&lt;/a&gt; and experience how this looks.&lt;br /&gt;&lt;br /&gt;This is a nice graphical representation of this OAUTH authentication process:&lt;br /&gt;&lt;a href="http://developers.new.digg.com/authentication"&gt;http://developers.new.digg.com/authentication&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The PHP library we use is the lib of Abraham Williams, which you can get here:&lt;br /&gt;&lt;a href="https://github.com/abraham/twitteroauth"&gt;https://github.com/abraham/twitteroauth&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Then you need your sercret key and token as described in the documentation at&lt;br /&gt;&lt;a href="http://dev.twitter.com/pages/auth"&gt;http://dev.twitter.com/pages/auth&lt;/a&gt;&lt;br /&gt;and change the files using your own secret key. &lt;br /&gt;&lt;br /&gt;At this lib I added a simple PHP file, which after logging in just writes an update Status:&lt;br /&gt;echo $connection-&amp;gt;post('statuses/update', array('status' =&amp;gt; $statusText.' at '.date(DATE_RFC822)));&lt;br /&gt;&lt;a href="http://www.blogger.com/goog_656539639"&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.contrechoc.com/crosslab/abrahamTwitter/writeStatusShort.php?statusText=hello%20world"&gt;http://www.contrechoc.com/crosslab/abrahamTwitter/writeStatusShort.php?statusText=hello world&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;From this last line Hello World can be twittered.... (if you are logged in...see OAUTH description).&lt;br /&gt;&lt;br /&gt;So putting the things together gives a movie, getting the last tweets, and being able to submit a tweet:&lt;br /&gt;&lt;a href="http://www.contrechoc.com/crosslab/abrahamTwitter/twitterFlashWithInput.html"&gt;http://www.contrechoc.com/crosslab/abrahamTwitter/twitterFlashWithInput.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;of course as an example this is giving contrechoc's tweets (rssfeed)- submitting tweets is only possible when logged in...the redirection page has to be altered.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;FLASH&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Then we return to FLASH scripting, to get a media response to a tweet, we will search for a string in a bit of text (tweet = text):&lt;br /&gt;&lt;br /&gt;for this we need a RegExp object:&lt;br /&gt;var myPattern:RegExp = /bestseller/gi;&lt;br /&gt;&lt;br /&gt;then we can search a String for this RegExp : (&lt;br /&gt;var bitOfText: String = "when the sea of inspiration is empty, all fishing for new ideas is in vain, unless you are a bestseller";&lt;br /&gt;//coming from a tweet for example&lt;br /&gt;if ( bitOfText.search(myPattern1) != -1 )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;trace ("found ", myPattern );&lt;br /&gt;//do something with it! &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&lt;br /&gt;When we have found "bestseller", then we can use the media template to show an image, or start a video, sound etc.&lt;br /&gt;&lt;br /&gt;We need the FLASH movie also to get updates itself. For this we use a timer:&lt;br /&gt;&lt;br /&gt;var myTimer: Timer;&lt;br /&gt;myTimer = new Timer(500);&lt;br /&gt;myTimer.addEventListener("timer", timerHandler);&lt;br /&gt;myTimer.start();&lt;br /&gt;&lt;br /&gt;function timerHandler(event:TimerEvent):void {&lt;br /&gt;&amp;nbsp;&amp;nbsp; //function to get rssfeed from twitter and go to search for certain words&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The file for this last example can be found here:&lt;br /&gt;&lt;a href="http://www.contrechoc.com/crosslab/twitter_media_Example.zip"&gt;http://www.contrechoc.com/crosslab/twitter_media_Example.zip&lt;/a&gt;&lt;br /&gt;When the FLASH movie is not the right version, you can take the script from the textfile in the folder, take a new FLASH file and copy this script inside the actions window. To get your own tweets inside a flash, you should alter the rssFeedURL inside the script.&lt;br /&gt;&lt;br /&gt;To write yourself tweets from your FLASH, as told, you need the whole bunch of PHP files and get yourself secret keys etc from twitter. &lt;br /&gt;&lt;br /&gt;This is an example of FLASH with OAUTH, which won't really work for you, because it is works only when I log in....&lt;br /&gt;&lt;a href="http://www.contrechoc.com/crosslab/abrahamTwitter/twitterFlashWithInput.html"&gt;http://www.contrechoc.com/crosslab/abrahamTwitter/twitterFlashWithInput.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Extra:&lt;br /&gt;search a word in all tweets:&lt;br /&gt;&lt;a href="http://search.twitter.com/search.atom?q=hello"&gt;http://search.twitter.com/search.atom?q=hello&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-7695305645306302095?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/7695305645306302095/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/01/twitter-in-flash-using-oauth.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/7695305645306302095'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/7695305645306302095'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/01/twitter-in-flash-using-oauth.html' title='Twitter in FLASH (using OAUTH)'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-3580035348345093724</id><published>2011-01-09T09:16:00.000-08:00</published><updated>2011-01-09T23:45:30.882-08:00</updated><title type='text'>Database excercizes</title><content type='html'>&lt;b&gt;Email&lt;/b&gt;&lt;br /&gt;We practiced making a table. Now look at email as a database-table, find all the necessary fields (and what is missing or not working for a single table?)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Twitter&lt;/b&gt;&lt;br /&gt;Look at twitter as database, the same questions. Get to your twitter account, see how the twittering works from the database side. Look here:&lt;br /&gt;In class links are shown for flash showing tweets, and submitting new tweets.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Layar&lt;/b&gt;&lt;br /&gt;database, how to do this yourself&lt;br /&gt;now&amp;nbsp; we understand what we did at hoppala:&lt;br /&gt;&lt;a href="http://augmentation.hoppala.eu/"&gt;http://augmentation.hoppala.eu/&lt;/a&gt;&lt;br /&gt;we can find the MYSQL code to make the layar database on our own free server without the hoppala tag:&lt;br /&gt;&lt;a href="http://layar.pbworks.com/w/page/30832324/First%20Layar%20Tutorial%20-%20Create%20a%20simple%20layer"&gt;http://layar.pbworks.com/w/page/30832324/First%20Layar%20Tutorial%20-%20Create%20a%20simple%20layer&lt;/a&gt;&lt;br /&gt;make this table on your server!&lt;br /&gt;See this post:&lt;br /&gt;&lt;a href="http://crosslabminor-layar.blogspot.com/2010/09/make-layar-layer-hard-way.html"&gt;http://crosslabminor-layar.blogspot.com/2010/09/make-layar-layer-hard-way.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;insert&lt;/b&gt;&lt;br /&gt;Inserting records in a table from a html page makes life easier:&lt;br /&gt;A link will be shown in class (fearing database injections!) which inserts records in my layar database.&lt;br /&gt;http://www.contrechoc.com/XXX/xxx&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Second Life&lt;/b&gt;....&lt;br /&gt;Nice 3D world. In fact, it is just a database visualisation. We have put a microphone somewhere, which records what is said in it's neighbourhood. The microphone is illustrating that everything in this world is recorded. The owner didn't want to be reminded of this fact!&lt;br /&gt;&lt;a href="http://www.nuggetkidd.byethost11.com/sl/loadToFlash_Nugget_Kidd.php"&gt;http://www.nuggetkidd.byethost11.com/sl/loadToFlash_Nugget_Kidd.php&lt;/a&gt;&lt;br /&gt;gives the raw data, which can be shown in a (undesigned) flash movie:&lt;br /&gt;&lt;a href="http://www.nuggetkidd.byethost11.com/minorCourse/loadDB_Nugget_Kidd.html"&gt;http://www.nuggetkidd.byethost11.com/minorCourse/loadDB_Nugget_Kidd.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The World&lt;/b&gt;&lt;br /&gt;Is our world just a database? &lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;a href="http://rop.gonggri.jp/?p=442"&gt;http://rop.gonggri.jp/?p=442&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Check this out:&lt;br /&gt;&lt;a href="http://www.online-tech-tips.com/google-softwaretips/use-gmail-as-an-online-database-with-super-fast-search/"&gt;http://www.online-tech-tips.com/google-softwaretips/use-gmail-as-an-online-database-with-super-fast-search/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-3580035348345093724?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/3580035348345093724/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/01/database-excercizes.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/3580035348345093724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/3580035348345093724'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2011/01/database-excercizes.html' title='Database excercizes'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-6219603898442032244</id><published>2010-12-27T00:20:00.000-08:00</published><updated>2011-01-03T02:42:00.078-08:00</updated><title type='text'>PHP dBase connections</title><content type='html'>We created a dataBase. Now we want to connect to it and show the results in a browser.&lt;br /&gt;&lt;br /&gt;We use PHP for this. The examples show some possibilities of PHP.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.nuggetkidd.byethost11.com/minorCourse/exampleInclude.php"&gt;http://www.nuggetkidd.byethost11.com/minorCourse/exampleInclude.php &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We use a file to connect tot the dataBase, the connectionHeader.&lt;br /&gt;We include this file in all the other files, so that when we have to change for example the password, we have to do this only once. And at the same time, the code in PHP is shorter, so it stays more clean.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.nuggetkidd.byethost11.com/minorCourse/includeHeader.php"&gt;http://www.nuggetkidd.byethost11.com/minorCourse/includeHeader.php &lt;/a&gt;&lt;br /&gt;(if all is well, using "view source" in the browser will not reveal the password, because the PHP code is transformed into HTML. The nonsense you see at the end of the file is what we eventuallu need for a connection from FLASH to this database. With FLASH we can do nice animations and interactions.)&lt;br /&gt;&lt;br /&gt;We connect to the database and ask for records, we get the records back and want to show the text and possible images in a nice list. For this we use a while loop.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.nuggetkidd.byethost11.com/minorCourse/loadToFlash3.php"&gt;http://www.nuggetkidd.byethost11.com/minorCourse/loadToFlash3.php &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Then we will show also the images using PHP calling the images in a folder with the names of the images form the database. The fact that you have to insert "-things into a string which already needs "-things makes life a bit complicated.&lt;br /&gt;You have to use \"-things before the "-things.....and this looks terrible!!!!!!&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.nuggetkidd.byethost11.com/minorCourse/images/php-code.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://www.nuggetkidd.byethost11.com/minorCourse/images/php-code.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://www.nuggetkidd.byethost11.com/minorCourse/loadToFlash4.php"&gt;http://www.nuggetkidd.byethost11.com/minorCourse/loadToFlash4.php&amp;nbsp;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here are the PHP - files we used:&lt;br /&gt;(of course the password in the connectionHeader.PHP has to be replaced by your own credentials.)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.nuggetkidd.byethost11.com/minorCourse/php-database.zip"&gt;http://www.nuggetkidd.byethost11.com/minorCourse/php-database.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;how to display an image in HTML, for example: &lt;a href="http://www.fund-online.com/alabook/htmldemo/img2.htm"&gt;http://www.fund-online.com/alabook/htmldemo/img2.htm&lt;/a&gt;&lt;br /&gt;some PHP documentation, for example:&lt;a href="http://php.net/manual/de/function.include.php"&gt;http://php.net/manual/de/function.include.php&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-6219603898442032244?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/6219603898442032244/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2010/12/php-dbase-connections.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/6219603898442032244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/6219603898442032244'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2010/12/php-dbase-connections.html' title='PHP dBase connections'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-3063539392842713836</id><published>2010-12-12T23:43:00.000-08:00</published><updated>2010-12-12T23:43:03.099-08:00</updated><title type='text'>making a DIY database</title><content type='html'>We will practice making a database, which we will need for another flash cs3 scripting miracle.&lt;br /&gt;&lt;br /&gt;For this we need a browser, like Firefox, with a FTP plugin, FireFTP.&lt;br /&gt;&lt;br /&gt;Then we need a host, like &lt;a href="http://www.byethost.com/free-hosting"&gt;&lt;span class="f"&gt;&lt;cite&gt;www.byethost.com/free-hosting&lt;/cite&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="f"&gt;&lt;cite&gt;if we have an account, we go to the admin panel:&lt;/cite&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="f"&gt;&lt;cite&gt; &lt;/cite&gt;&lt;/span&gt;&lt;br /&gt;&lt;a href="http://panel.byethost.com/" target="_blank"&gt;http://panel.byethost.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;and we log in with our new account name and password.&lt;br /&gt;&lt;br /&gt;Then we go to: php admin, and create a database.&lt;br /&gt;We go to the MYSQL page and we can start making a table.&lt;br /&gt;&lt;br /&gt;After making a table with fields, we start filling the fields and practice a bit inserting, deleting and searches.&lt;br /&gt;&lt;br /&gt;Then we look at the MYSQL code and we copy this code and save it for later on.&lt;br /&gt;&lt;br /&gt;The next step is looking a PHP pages.&lt;br /&gt;With these pages we call the database and get the records.&lt;br /&gt;&lt;br /&gt;First of all we will produce some "HTML" pages with the PHP pages, to get used to the coding.&lt;br /&gt;The we will insert the MYSQL code into th PHP and look at the results.&lt;br /&gt;&lt;br /&gt;My PHP examples can be found here:&lt;br /&gt;&lt;a href="http://www.contrechoc.com/crosslab/php-examples.zip"&gt;http://www.contrechoc.com/crosslab/php-examples.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;(The password has to be replaced.)&lt;br /&gt;&lt;br /&gt;PHP references can be found everywhere:&lt;br /&gt;&lt;a href="http://www.w3schools.com/php/default.asp"&gt;http://www.w3schools.com/php/default.asp&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;also on this page PHP Database (on the left), this gives MYSQL code&lt;br /&gt;&lt;a href="http://www.w3schools.com/php/php_mysql_intro.asp"&gt;http://www.w3schools.com/php/php_mysql_intro.asp&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="f"&gt;&lt;cite&gt; &lt;/cite&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-3063539392842713836?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/3063539392842713836/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2010/12/making-diy-database.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/3063539392842713836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/3063539392842713836'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2010/12/making-diy-database.html' title='making a DIY database'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-6107440238822281281</id><published>2010-11-25T23:37:00.003-08:00</published><updated>2010-12-16T22:05:11.849-08:00</updated><title type='text'>Using a webcam</title><content type='html'>&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;Today we will be fooling around with webcam.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;First of all we can load a webcam on the screen (or stage). This is done in a function.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;The webcam can trigger loading of images and playing of sounds etc, (so can the microphone.)&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;The  structure of the script is not too difficult: you add an object (there  is the box again), this object is a webcam for tonight. Then you add an  eventlistener. And the eventlisteners triggers a function when the event  happens.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;So we have:&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;webcam&lt;/li&gt;&lt;li&gt;eventlistener&lt;/li&gt;&lt;li&gt;function on event&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;This is the same as:&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;keyboard - eventlistener - function on event&lt;/li&gt;&lt;li&gt;mouse - eventlistener - function on event&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;In the function you can put what you want, it can be loading an image, playing a sound...starting a movie......&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;The way to create the webcam is done in a function. This is like the functions of  loading an image or streaming a sound. In principle you can copy paste  these functions and use them like black boxes.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;The working examples can be found in this folder, with examples:&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;a href="http://www.contrechoc.com/flash/flashExamples.zip"&gt;http://www.contrechoc.com/flash/flashExamples.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;if FLASH complains about the version of the .fla file, use the content of the txt file in the folder, copy paste it into a new flash movie, save in the folder with the sounds and images, and enjoy...&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;A funny examples from former classes:&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;a href="http://www.contrechoc.com/flash/DanutasSnorrenShow/webcam.html"&gt;http://www.contrechoc.com/flash/DanutasSnorrenShow/webcam.html&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;Made by Danuta, in her movie your mustache is changed when moving  around!&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-weight: bold;"&gt;Security setting&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;Flash  is played from website on your computer. So flash movies are not  supposed to be able to get data from your computer. Nor are flash movies  supposed to activate your webcam without your consent. So every time  you use the webcam you have to give permission to do this.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;So there is a possibility that when you start the movie with the webcam it wont play immediately.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;If  nothing is playing or the mic does not respond, first verify if the  computer has a mic or webcam, and then try clicking right in the flash  window and look at the settings.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;More can be done with  the webcam than you think: Augmented Reality Flash, or Multitouch Flash  is done also with this simple webcam.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;Remark: close  scrutiny showed that the activity handler is always triggering two times  before tting into the normal waiting for a trigger mode. So to do it  well,&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;used:&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;* webcam activity: eventlistener&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;* microphone activity: eventlistener&lt;br /&gt;&lt;br /&gt;Advanced: you can have a picture, and want to replace colors in it? Using a blue screen for example.&lt;br /&gt;&lt;a href="http://keywon.com/wiki/index.php?title=Flash_Reference_-_BitmapData"&gt;http://keywon.com/wiki/index.php?title=Flash_Reference_-_BitmapData&lt;/a&gt;&lt;br /&gt;You can do this on the image of the webcam too, replacing the color of a Hummer with the color on a specific spot of the webcam.&lt;br /&gt;Using&amp;nbsp; lightsource as a mouse works like this, webcam, bitmapimage, threshold...&lt;br /&gt;&lt;a href="http://board.flashkit.com/board/showthread.php?t=753887"&gt;http://board.flashkit.com/board/showthread.php?t=753887&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-6107440238822281281?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/6107440238822281281/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2010/11/using-webcam.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/6107440238822281281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/6107440238822281281'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2010/11/using-webcam.html' title='Using a webcam'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-3510520167710787932</id><published>2010-11-25T23:37:00.002-08:00</published><updated>2010-11-25T23:37:26.210-08:00</updated><title type='text'>Using mouse input</title><content type='html'>&lt;span style="font-weight: bold;"&gt;The mouse input, using the eventListener&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;The mouse is more versatile than a key!&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Handling the mouse also creates events like the keys.&lt;br /&gt;We can attach reactions like the ones we practiced with the keys also to the mouse.&lt;br /&gt;Again we use an eventlistener:&lt;br /&gt;&lt;br /&gt;stage.addEventListener (.... )&lt;br /&gt;also we have to add a function which defines what to do with the events triggered:&lt;br /&gt;stage.addEventListener (...., whatToDoWithTriggerFunction)&lt;br /&gt;the whatToDoWithTriggerFunction will have to be defined.&lt;br /&gt;&lt;br /&gt;Here are several eventlisteners for the mouse (different kind of triggers, clicking moving):  &lt;br /&gt;&lt;ul&gt;&lt;li&gt;addEventListener(MouseEvent.CLICK,  clickHandler);&lt;/li&gt;&lt;li&gt;addEventListener(MouseEvent.DOUBLE_CLICK,  doubleClickHandler);&lt;/li&gt;&lt;li&gt;        addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);&lt;/li&gt;&lt;li&gt;        addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);&lt;/li&gt;&lt;li&gt;         addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);&lt;/li&gt;&lt;li&gt;          addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);&lt;/li&gt;&lt;/ul&gt;Then in the function we can track different kind of properties:&lt;br /&gt;&amp;nbsp;For example the mouse point has x and y coordinates.&lt;br /&gt;&lt;br /&gt;So the recepie is like this: &lt;br /&gt;&lt;br /&gt;add an eventListener:&lt;br /&gt;stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);&lt;br /&gt;&lt;br /&gt;and the corresponding reaction:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;function mouseUpHandler( event:MouseEvent): void&lt;br /&gt;{&lt;br /&gt;var posX : Number =  event.stageX;&lt;br /&gt;var posY : Number = event.stageY;&lt;br /&gt;myMovieClip1.x = posX ;&lt;br /&gt;myMovieClip1.y = posY ;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-3510520167710787932?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/3510520167710787932/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2010/11/using-mouse-input.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/3510520167710787932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/3510520167710787932'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2010/11/using-mouse-input.html' title='Using mouse input'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-4010691734657115074</id><published>2010-11-25T23:37:00.001-08:00</published><updated>2010-12-06T03:06:52.895-08:00</updated><title type='text'>Using the arrow keys</title><content type='html'>&amp;nbsp;If you want to move images around, you shift the container of the  images, the movieClip. You could do this using keys from the keyboard,  but more fun is to use the arrow keys. The code for this is a bit  different from the normal keys:&lt;br /&gt;&lt;br /&gt;normal keys were triggered like this:&lt;br /&gt;&lt;div style="color: red;"&gt;if (String.fromCharCode( event.charCode) == "5")&lt;/div&gt;&lt;div style="color: red;"&gt;{&lt;/div&gt;&lt;div style="color: red;"&gt;myMovieClip1.x = myMovieClip1.x - 50;&lt;/div&gt;&lt;div style="color: red;"&gt;}&lt;/div&gt;&lt;br /&gt;but with the arrows we have to do it like this:(using only the &lt;span style="color: red;"&gt;event.keyCode)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: red;"&gt;&amp;nbsp;if (event.keyCode == 38 )//up&lt;/span&gt;&lt;br style="color: red;" /&gt;&lt;span style="color: red;"&gt;{&lt;/span&gt;&lt;br style="color: red;" /&gt;&lt;span style="color: red;"&gt;myMovieClipWithCar1.y = myMovieClipWithCar1.y - 50;&lt;/span&gt;&lt;br style="color: red;" /&gt;&lt;span style="color: red;"&gt;}&lt;/span&gt;&lt;br style="color: red;" /&gt;&lt;br style="color: red;" /&gt;&lt;span style="color: red;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (event.keyCode == 40 )//down&lt;/span&gt;&lt;br style="color: red;" /&gt;&lt;span style="color: red;"&gt;{&lt;/span&gt;&lt;br style="color: red;" /&gt;&lt;span style="color: red;"&gt;myMovieClipWithCar1.y = myMovieClipWithCar1.y + 50;&lt;/span&gt;&lt;br style="color: red;" /&gt;&lt;span style="color: red;"&gt;}&lt;/span&gt;&lt;br style="color: red;" /&gt;&lt;br style="color: red;" /&gt;&lt;span style="color: red;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (event.keyCode == 37 )//left&lt;/span&gt;&lt;br style="color: red;" /&gt;&lt;span style="color: red;"&gt;{&lt;/span&gt;&lt;br style="color: red;" /&gt;&lt;span style="color: red;"&gt;myMovieClipWithCar1.x = myMovieClipWithCar1.x - 50;&lt;/span&gt;&lt;br style="color: red;" /&gt;&lt;span style="color: red;"&gt;}&lt;/span&gt;&lt;br style="color: red;" /&gt;&lt;br style="color: red;" /&gt;&lt;span style="color: red;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (event.keyCode == 39 )//right&lt;/span&gt;&lt;br style="color: red;" /&gt;&lt;span style="color: red;"&gt;{&lt;/span&gt;&lt;br style="color: red;" /&gt;&lt;span style="color: red;"&gt;myMovieClipWithCar1.x = myMovieClipWithCar1.x + 50;&lt;/span&gt;&lt;br style="color: red;" /&gt;&lt;span style="color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;that   is because the characters and letters are having a charCode (ASCII   code) but the arrows don't represent "normal" characters. The other keys   are having keyCode too, of course, but "charCode" is more like   "character".&lt;br /&gt;&lt;br /&gt;Then using the arrow codes: keyCode = 37 or 38 or 39 or 40 you can steer an image around on the Stage.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-4010691734657115074?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/4010691734657115074/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2010/11/using-arrow-keys.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/4010691734657115074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/4010691734657115074'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2010/11/using-arrow-keys.html' title='Using the arrow keys'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-882920774573531656</id><published>2010-11-25T23:37:00.000-08:00</published><updated>2010-12-06T00:02:55.037-08:00</updated><title type='text'>Using a custom made media template</title><content type='html'>&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;We will use these templates in practicing programming techniques like using a timer, using an eventListener, in combination with progressive downloading of image, sound and video, :&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;a href="http://www.contrechoc.com/flash/flashExamples.zip"&gt;http://www.contrechoc.com/flash/flashExamples.zip&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;This folder contains an example with a timer, a sound on keyboard input, an image on keyboard input and the same with all media and video.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;With the programming experience of the first blog we will modify the script and make a story using the media variables, like sound, image, and video.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;This&amp;nbsp; example is the media (sound, image, video on keyboard input) template on it's own:&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;a href="http://www.contrechoc.com/flash/easy_Flash_Media_Usage.zip"&gt;http://www.contrechoc.com/flash/easy_Flash_Media_Usage.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We import classes to load an Image and read a Sound (and play it directly).&lt;br /&gt;When we know how to use the classes we dont have to comprehend anything about how this functions.&lt;br /&gt;&lt;br /&gt;How to use a class?&lt;br /&gt;first import it:&lt;br /&gt;&lt;div style="color: red;"&gt;import LoadImageInMovieClip;&lt;/div&gt;then declare a variable of this class (that is prepare the memory for it.)&lt;br /&gt;giving it parameters:&lt;br /&gt;&lt;div style="color: red;"&gt;var myMovieClipWithCarImage : LoadImageInMovieClip = new LoadImageInMovieClip( imageName);&lt;/div&gt;The imageName is a parameter and you have to know that you have to give the name of the image. This image must be in the folder called Images.&lt;br /&gt;&lt;br /&gt;Then using this imageClip: putting it on stage&lt;br /&gt;&lt;div style="color: red;"&gt;stage.addChild(myMovieClipWithCarImage);&lt;/div&gt;&lt;br /&gt;and then later on, removing it from stage:&lt;br /&gt;&lt;div style="color: red;"&gt;stage.removeChild(myMovieClipWithCarImage);&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;span style="color: black;"&gt;or repositioning it:&lt;/span&gt;&lt;/div&gt;&lt;div style="color: red;"&gt;myMovieClipWithCarImage.x = 500;&lt;/div&gt;&lt;div style="color: red;"&gt;&lt;br /&gt;&lt;/div&gt;The next example is sound:&lt;br /&gt;&lt;div style="color: red;"&gt;import PlaySound;&lt;/div&gt;&lt;br /&gt;&lt;div style="color: red;"&gt;var mySound: PlaySound = new PlaySound(nameOfSound, numberOfTimesPlayed, volume);&lt;/div&gt;these last 3 parameters.....you have to know them..for instance the volume has to be between 0 and 1.&lt;br /&gt;&lt;div style="color: red;"&gt;var mySound: PlaySound = new PlaySound("1.mp3", 3,.5 );&lt;/div&gt;&lt;br /&gt;and that is all there is to using the classes.&lt;br /&gt;&lt;br /&gt;The video is more complicated in the example:&lt;br /&gt;I have prepared the way for multiple video's, putting the video's in an array. These video's have no names, I call them with the place they occupy in the array. The first place is called 0!&lt;br /&gt;(This is always true in programming.)&lt;br /&gt;&lt;br /&gt;But lets say you want only one video:&lt;br /&gt;&lt;br /&gt;&lt;div style="color: red;"&gt;import NetConnectionVideoClass;&lt;/div&gt;&lt;div style="color: red;"&gt;var myVideo: NetConnectionVideoClass = new NetConnectionVideoClass("MOV00948.flv");&lt;/div&gt;there are a lot of functions for a video! &lt;br /&gt;&lt;div style="color: red;"&gt;stage.addChild(myVideo);//putting it onto stage.&lt;/div&gt;&lt;div style="color: red;"&gt;myVideo.addVideoChild();//starting the stream (the naming can be improved!)&lt;br /&gt;myVideo.loopPlayVideo();&lt;/div&gt;&lt;div style="color: red;"&gt;myVideo.pauseVideo();&lt;br /&gt;myVideo.resumeVideo();&lt;/div&gt;&lt;div style="color: red;"&gt;myVideo.videoAlpha(whatTransparency);// between 0 and 1&lt;/div&gt;&lt;span style="color: red;"&gt;myVideo.videoRot(numberOfDegrees);&lt;/span&gt;&lt;br /&gt;try it out!&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;As an extra assignment, I have made a class, TransformImage, which can blend one image into the other, learn how to use it without any understanding!&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;import this class:&amp;nbsp;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;b&gt;import TransformImage;&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;You have to make a MovieClip, add this thing to the Stage.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;b&gt;var myMovieClip5: MovieClip = new MovieClip();&lt;br /&gt;stage.addChild(myMovieClip5);&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;Then create an instance of TransformImage: (with parameters, this MovieClip, and the names of the images.)&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;b&gt;var myTransformMovieClip  : TransformImage;&lt;/b&gt; &lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;b&gt;myTransformMovieClip = new TransformImage(myMovieClip5, "car1.png","car2.png" );&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;and look how image 1 is transformed in image 2.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;The images have to be placed in the folder images as usual &lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;You need the class don't you? (It is also in the folder with the examples)&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;a href="http://www.contrechoc.com/flash/TransformImage.zip"&gt;http/:www.contrechoc.com/flash/TransformImage.zip&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;put it in the folder where the flash .fla is, otherwise your .fla will not find it and complain.&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-882920774573531656?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/882920774573531656/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2010/11/using-custom-made-media-template.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/882920774573531656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/882920774573531656'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2010/11/using-custom-made-media-template.html' title='Using a custom made media template'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7036346606788760601.post-8834295888536549518</id><published>2010-11-22T06:30:00.000-08:00</published><updated>2010-11-25T05:05:02.472-08:00</updated><title type='text'>Flash: how to get used to scritping</title><content type='html'>&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;This blog will show simple scripting in the script window using a few variables and the trace function. It illustrates using a function and some programming techniques.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;Open Flash&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;Open a Flash AS.3 movie.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;The reason we use AS3 and not AS2 is that AS3 is a language which is like other programming languages. SO what you learn for AS3 you can also use in JAVA, ARDUINO scripting etc.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;The go to WINDOW Actions, the Actions window opens.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;Start typing:&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;trace ("Hello World of Frogs");&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;look at the colors of the script, blue is a system word, the text is in green.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;then we make a variable:&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;var theNumberOfFrogs : Number = 555;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;This line prepares the memory for a Number.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;The way of writing is a bit strange: it is called Elephants notation, it is like this because spaces are not allowed and we need to get the name descriptive anyway.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;There can be other variables made eg a MovieClip:&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;var thisIsAMovieClip : MovieClip = new MovieClip();&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;Look at the notation:&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;conventions are to start a variable name with a small character and a class (Number, MovieClip) with a capital.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;also:&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;choose the name of the variable carefully so that after 20 pages of script you know what the variable is about by reading the name.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;this is a bad name:&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;var f : Number = 0;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;because you cannot see what this variable is supposed to contain.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;now continue with:&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;trace("the number of frogs is:", theNumberOfFrogs );&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;compile the movie using CMD ENTER of CTRL ENTER&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;then the output window opens en you get a result.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;continue with:&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;var theNumberOfFrogsEatenEachNight : Number = 123;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;theNumberOfFrogs = theNumberOfFrogs - theNumberOfFrogsEatenEachNight;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;trace( "the number of Frogs left is:", theNumberOfFrogs);&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;this means: theNumberOfFrogs becomes what is was minus theNumberOfFrogsEatenEachNight&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;now you see the variable in action, it can be changed!&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;repeat, copy paste:&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;theNumberOfFrogs = theNumberOfFrogs - theNumberOfFrogsEatenEachNight;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;trace( "the number of Frogs left is:", theNumberOfFrogs);&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;theNumberOfFrogs = theNumberOfFrogs - theNumberOfFrogsEatenEachNight;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;trace( "the number of Frogs left is:", theNumberOfFrogs);&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;theNumberOfFrogs = theNumberOfFrogs - theNumberOfFrogsEatenEachNight;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;trace( "the number of Frogs left is:", theNumberOfFrogs);&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;you see the number of theNumberOfFrogs diminishing, it can even become negative.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;What is a negative frog???&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;So we want to avoid that!&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;we type: and now I use the special code blocks because I want to use a character smaller than, used in html....&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre style="background: url(&amp;quot;http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif&amp;quot;) repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: Arial,Helvetica,sans-serif; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt;  if (theNumberOfFrogs &amp;lt; 0)&lt;br /&gt;theNumberOfFrogs=0;&lt;br /&gt;//which becomes:&lt;br /&gt;if (theNumberOfFrogs &amp;lt; 0)  {&lt;br /&gt;theNumberOfFrogs=0;&lt;br /&gt;trace(" you have eaten all frogs!");&lt;br /&gt;}&lt;br /&gt;//if I want to be noticed that there are no frogs left.&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;I am using // to indicate a comment in the code, that line is not seen as code, its color is light grey.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;But now I want to get rid of the repetitions.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;First of all we make a machine called function which can be called each night:&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre style="background: url(&amp;quot;http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif&amp;quot;) repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: Arial,Helvetica,sans-serif; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; function eatingOfFrogsEachNight() {&lt;br /&gt;theNumberOfFrogs=theNumberOfFrogs-theNumberOfFrogsEatenEachNight;&lt;br /&gt;if (theNumberOfFrogs &amp;lt; 0) {&lt;br /&gt;theNumberOfFrogs=0;&lt;br /&gt;trace(" you have eaten all frogs!");&lt;br /&gt;}&lt;br /&gt;trace( "the number of Frogs left is:", theNumberOfFrogs);&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;This function can be called every time we want to use it, even if we don't know how it functions exactly! The name should be obvious like loadImage(), or loadAndPlaySound().&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;Then we make a loop, to avoid repeating the function call:&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre style="background: url(&amp;quot;http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif&amp;quot;) repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: Arial,Helvetica,sans-serif; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; for (var i: Number = 0; i &amp;lt; 1000; i=i+1) {&lt;br /&gt;eatingOfFrogsEachNight();&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;Now the poor frogs are eaten a 1000 times!&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;But that is far too much, we want to stop the loop if there are no frogs left:&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;So we need another if statement:&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre style="background: url(&amp;quot;http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif&amp;quot;) repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: Arial,Helvetica,sans-serif; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; for (var i: Number = 0; i &amp;lt; 1000; i=i+1) {&lt;br /&gt;eatingOfFrogsEachNight();&lt;br /&gt;if (theNumberOfFrogs&amp;lt;=0) {&lt;br /&gt;i=1000;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;It is placed inside the loop and it will finish the loop when the number of frogs left is 0.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;So know we have seen a lot of things, variables, if statements, for loops, and functions.&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;The whole script is like this:&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre style="background: url(&amp;quot;http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif&amp;quot;) repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: Arial,Helvetica,sans-serif; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; trace("Hello World of Frogs");&lt;br /&gt;var theNumberOfFrogs:Number=555;&lt;br /&gt;var theNumberOfFrogsEatenEachNight:Number=23;&lt;br /&gt;for (var i: Number = 0; i &amp;lt; 1000; i=i+1) {&lt;br /&gt;eatingOfFrogsEachNight();&lt;br /&gt;if (theNumberOfFrogs&amp;lt;=0) {&lt;br /&gt;i=1000;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;function eatingOfFrogsEachNight() {&lt;br /&gt;theNumberOfFrogs=theNumberOfFrogs-theNumberOfFrogsEatenEachNight;&lt;br /&gt;if (theNumberOfFrogs&amp;lt;0) {&lt;br /&gt;theNumberOfFrogs=0;&lt;br /&gt;trace(" you have eaten all frogs!");&lt;br /&gt;}&lt;br /&gt;trace( "the number of Frogs left is:", theNumberOfFrogs);&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&amp;nbsp;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_Jq__kevBr8s/TOqJOUQTBMI/AAAAAAAABYE/65fS7Gf0ML4/s1600/Image%2B1.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5542393170481054914" src="http://1.bp.blogspot.com/_Jq__kevBr8s/TOqJOUQTBMI/AAAAAAAABYE/65fS7Gf0ML4/s400/Image%2B1.jpg" style="cursor: pointer; float: left; height: 244px; margin: 0pt 10px 10px 0pt; width: 400px;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;The output is this:&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_Jq__kevBr8s/TOqJZGi32CI/AAAAAAAABYM/ZTd7IMJ-AQM/s1600/Image%2B2.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5542393355779430434" src="http://4.bp.blogspot.com/_Jq__kevBr8s/TOqJZGi32CI/AAAAAAAABYM/ZTd7IMJ-AQM/s400/Image%2B2.jpg" style="cursor: pointer; float: left; height: 400px; margin: 0pt 10px 10px 0pt; width: 267px;" /&gt;&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7036346606788760601-8834295888536549518?l=flashscriptingwonders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://flashscriptingwonders.blogspot.com/feeds/8834295888536549518/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://flashscriptingwonders.blogspot.com/2010/11/flash-how-to-get-used-to-scritping.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/8834295888536549518'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7036346606788760601/posts/default/8834295888536549518'/><link rel='alternate' type='text/html' href='http://flashscriptingwonders.blogspot.com/2010/11/flash-how-to-get-used-to-scritping.html' title='Flash: how to get used to scritping'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Jq__kevBr8s/TOqJOUQTBMI/AAAAAAAABYE/65fS7Gf0ML4/s72-c/Image%2B1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
