{"id":365,"date":"2009-08-03T07:42:06","date_gmt":"2009-08-03T14:42:06","guid":{"rendered":"https:\/\/actionsnippet.com\/?p=1900"},"modified":"2009-08-03T07:42:06","modified_gmt":"2009-08-03T14:42:06","slug":"i-want-twitter","status":"publish","type":"post","link":"https:\/\/actionsnippet.com\/?p=365","title":{"rendered":"I want Twitter"},"content":{"rendered":"<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\n&#x5B;SWF(width = 800, height=600, frameRate=15)]\r\n\r\nvar littleTxt:TextField = TextField(addChild(new TextField()));\r\nwith (littleTxt){\r\n\tdefaultTextFormat = new TextFormat(&quot;_sans&quot;, 10);\r\n\twidth = stage.stageWidth-20;\r\n\theight = stage.stageHeight-20;\r\n\tmultiline = true;\r\n\twordWrap = true;\r\n\ttext =&quot;&quot;;\r\n\ttextColor = 0x444444;\r\n\tselectable = false;\r\n\tx = y = 10;\r\n}\r\n\r\nvar txt:TextField = TextField(addChild(new TextField()));\r\nwith (txt){\r\n\tdefaultTextFormat = new TextFormat(&quot;_sans&quot;, 90);\r\n\tautoSize = &quot;center&quot;;\r\n\tx = 0\r\n\ty = stage.stageHeight \/ 2 - 61\r\n\twidth = stage.stageWidth;\r\n\tselectable = false;\r\n\ttext = &quot;loading&quot;;\r\n}\r\n\r\nvar selectWords:Array = &#x5B;];\r\naddEventListener(Event.ENTER_FRAME, onLoop);\r\nfunction onLoop(evt:Event):void {\r\n     if (selectWords.length &gt; 0){\r\n\t\tvar word:String = selectWords&#x5B;int(Math.random() * selectWords.length)];\r\n\t\ttxt.text = word;\r\n\t\tlittleTxt.appendText(word+&quot; &quot;);\r\n\t }\r\n}\r\n\r\nvar loader:URLLoader = new URLLoader();\r\nvar req:URLRequest = new URLRequest(&quot;http:\/\/search.twitter.com\/search.atom&quot;);\r\nvar vars:URLVariables = new URLVariables();\r\nvars.q = &quot;i want&quot;;\r\n\/\/ results per page\r\nvars.rpp = &quot;50&quot;;\r\nvars.page = 1;\r\nvars.lang = &quot;en&quot;;\r\n\r\nreq.data = vars;\r\nreq.method = URLRequestMethod.POST;\r\nloader.load(req);\r\nloader.addEventListener(Event.COMPLETE, onLoaded);\t\t\t\t\t\t\t\t\t\r\nfunction onLoaded(evt:Event):void{\r\n\tvar searchData:XML = new XML(loader.data);\r\n\tvar atom:Namespace = searchData.namespace(&quot;&quot;);\r\n\tdefault xml namespace = atom;\r\n\tvar titles:String = &quot;&quot;;\r\n\tfor each(var entry:XML in searchData.entry){\r\n\t\ttitles += entry.title.toString();\r\n\t}\r\n\tvar index:int = 0;\r\n\tvar words:Array = titles.split(&quot; &quot;);\r\n\tfor (var i:int = 0; i&lt;words.length; i++){\r\n\t\t\/\/ exclude a few things\r\n\t\tif (words&#x5B;i].match(\/RT|@|#|http\/g).length == 0){\r\n\t\t\tselectWords&#x5B;index++] = words&#x5B;i];\r\n\t\t}\r\n\t}\r\n}\r\n<\/pre>\n<p>This snippet searches twitter for the phrase &#8220;I want&#8221; and then displays the results randomly word by word in a somewhat hypnotic way.<\/p>\n<p><a data-asruffle-linked=\"true\" href=\"http:\/\/www.actionsnippet.com\/swfs\/iwantwit.html\" target=\"blank\"><br \/>\nHave a look at the swf&#8230;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/actionsnippet.com\/wp-content\/want.gif\" \/><\/a> <span class=\"asruffle-link\" data-swf=\"{&quot;url&quot;:&quot;https:\\\/\\\/actionsnippet.com\\\/swfs\\\/iwantwit.swf&quot;,&quot;title&quot;:&quot;iwantwit&quot;,&quot;width&quot;:800,&quot;height&quot;:600,&quot;missing&quot;:false,&quot;allowScriptAccess&quot;:false,&quot;backgroundColor&quot;:&quot;#ffffff&quot;}\"><button type=\"button\" hidden aria-expanded=\"false\">Play demo<span class=\"screen-reader-text\">: iwantwit<\/span><\/button><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#x5B;SWF(width = 800, height=600, frameRate=15)] var littleTxt:TextField = TextField(addChild(new TextField())); with (littleTxt){ defaultTextFormat = new TextFormat(&quot;_sans&quot;, 10); width = stage.stageWidth-20; height = stage.stageHeight-20; multiline = true; wordWrap = true; text =&quot;&quot;; textColor = 0x444444; selectable = false; x = y = 10; } var txt:TextField = TextField(addChild(new TextField())); with (txt){ defaultTextFormat = new TextFormat(&quot;_sans&quot;, 90); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[88,20,21],"tags":[3,14,4,128],"class_list":["post-365","post","type-post","status-publish","format-standard","hentry","category-external-data","category-string-manipulation","category-strings","tag-actionscript","tag-as3","tag-flash","tag-twitter"],"_links":{"self":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/365","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=365"}],"version-history":[{"count":0,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/365\/revisions"}],"wp:attachment":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}