Actionscript:
-
[SWF(width = 800, height=700, frameRate=30, backgroundColor=0x000000)]
-
var canvas:BitmapData = new BitmapData(1000,800,false, 0x000000);
-
addChild(new Bitmap(canvas));
-
-
var coords:String ="";
-
var index:int = 0;
-
addEventListener(Event.ENTER_FRAME, onLoop);
-
-
var s:Shape = new Shape();
-
with (s.graphics) beginFill(0xFFFFFF, 0.3), drawCircle(4,4,4)
-
var brush:BitmapData = new BitmapData(10,10, true, 0x00000000);
-
brush.draw(s);
-
-
var pnt:Point = new Point();
-
function onLoop(evt:Event):void {
-
if (coords.length> 0){
-
for (var i:int = 0; i<100;i++){
-
if (index <coords.length){
-
pnt.x+= 0.2;
-
pnt.y = parseInt(coords.substr(index,3), 32) / 2;
-
index+=3;
-
canvas.copyPixels(brush, brush.rect, pnt, null, null, true);
-
}else{
-
break;
-
removeEventListener(Event.ENTER_FRAME, onLoop);
-
}
-
}
-
}
-
}
-
-
var loader:URLLoader = new URLLoader();
-
var req:URLRequest = new URLRequest("http://search.twitter.com/search.atom");
-
var vars:URLVariables = new URLVariables();
-
vars.q = "as3, flash";
-
vars.rpp = "100";
-
vars.page = 1;
-
vars.lang = "en";
-
req.data = vars;
-
req.method = URLRequestMethod.POST;
-
loader.load(req);
-
loader.addEventListener(Event.COMPLETE, onLoaded);
-
function onLoaded(evt:Event):void{
-
var searchData:XML = new XML(loader.data);
-
var atom:Namespace = searchData.namespace("");
-
default xml namespace = atom;
-
var titles:String = "";
-
for each(var entry:XML in searchData.entry){
-
titles += entry.title.toString();
-
}
-
var index:int = 0;
-
var words:Array = titles.split(" ");
-
words.sort();
-
for (var i:int = 0; i<words.length; i++){
-
if (words[i].match(/RT|\@|\#|http/g).length == 0){
-
var word:String = words[i].replace(/[\W]/g, "");
-
if (word.length> 1){
-
coords += word + " ";
-
}
-
}
-
}
-
}
This snippet does a twitter search and sorts the results alphabetically. It then reads through the results 3 characters at a time - each set of 3 characters is converted to base32 and then used a y coordinate on a plot.
In order for the swf to be worth looking at, I think I'd need to add an input field. I may do that later... but for now here are a few stills:
2 Comments
this is not really random, is it
not very random… also I’m sorting the results - really has to do more with the frequency of certain combinations of letters occurring…