Twitter AS3 library TwitterScript Flex Example

I have been looking around for Actionscript 3 libraries for the retrieval of data via the very nice Twitter API. Basically, TwitterScript seems to be a good choice for a Twitter Flash library as it wraps Twitter query URLs and packs the XML results automatically in arrays.

Twitter Banner

However, as so often with Actionscript libraries there is NO documentation pertaining TwitterScript available on its Google code page, there is no example included in the source code and the source code is not commented. What could be so difficult about providing a little piece of code like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" 
      addedToStage="init()">
  <mx:Script>
    <![CDATA[
      import twitter.api.data.TwitterStatus;
      import twitter.api.events.TwitterEvent;
      import twitter.api.TwitterSearch;
        import twitter.api.Twitter;
 
      private static const TWITTER_USER:String = "stephenfry";
 
      private var _twitter:Twitter;
      private var _twitterSearch:TwitterSearch;
 
      private function init():void{
        _twitter = new Twitter();
        _twitterSearch = new TwitterSearch();
 
        _twitter.loadUserTimeline(TWITTER_USER);
        _twitter.addEventListener(TwitterEvent.ON_USER_TIMELINE_RESULT, 
            userTimelineResult);
 
        _twitterSearch.addKeyword("ipad");
        _twitter.addEventListener(TwitterEvent.ON_SEARCH, onSearchResult, 
            false,0,true);
        _twitter.search(_twitterSearch);
      }
 
      private function userTimelineResult(e:TwitterEvent):void {
        var twitterStatus:TwitterStatus;
        for (var i in e.data) {
          twitterStatus = e.data[i]
          trace("user tweets",twitterStatus.text)
        }
      }
 
      private function onSearchResult(event : TwitterEvent) : void{
        var twitterStatus : TwitterStatus;
        for (var i : int = 0; i < event.data.length; i++){
          twitterStatus = event.data[i];
          trace("search result:",twitterStatus.text);
        }
      }
    ]]>
  </mx:Script>
</mx:Application>

This example originates to Trevor Boyle’s blog. Improved by Kimi.

Touchlib’s TUIO Actionscript 3 Classes Enhanced With Fiducial Support (Source Code)

Important: I discontinued the work for fiducialtuioas3. If you are starting a new project, consider using our new AS3 Tuio library Tuio AS3. As you most certainly came here because you want to use fiducials in AS3 find the according Tuio AS3 fiducial howto here.

In his Bachelor thesis Frederic Frieß enhanced the original Touchlib TUIO AS3 classes with support for fiducials (or to speak in TUIO terms with support for /tuio/2dobj messages).

fiducialtuioas3 Google code

Thus, the Touchlib’s TUIO classes can simply be replaced with Frederic’s classes and everything should still work as before. However, there is one slight change in the package structure: the TUIO classes are now lying inside the package tuio and not in the package flash.events.

I have made Frederic’s Tuio Fiducial AS3 classes available on Google code in a project called fiducialtuioas3.

If you want to use reacTIVision fiducials in Flash, Flex or Adobe Air you are heartily invited to use these classes in your private and professional project.

Examples of what has been done so far with those classes:
Tangible Vispol
Pf Design Media Installation

If you have a nice project with fiducialtuioas3 it would be great if you shared a link with us via mail or in the comments.

Remove Adobe Air Status Bar (in Flex Builder) [Update]

This is something so simple but it took me hours to figure it out (actually I do not know why): I wanted to remove the status bar from my Adobe Air application window. I use Flex Builder to develop my Air application.

I wanted to remove the status bar in the bottom of the window because it is useless and it looks bad in fullscreen mode.

As standard MXML element Flex Builder uses the mx:WindowedApplication. You just have to add a simple
showStatusBar="false"
and you get rid of that stupid status bar.

[Update 8. April 2009]
Setting
showStatusBar="false"
just causes the status bar to not being displayed. However, it is still there but not visible.

Thus, I added
windowComplete="removeStatusBar(event);"
in the title tag of WindowedApplication and implemented removeStatusBar(event) as following:

private function removeStatusBar(event:AIREvent):void{
removeChild(statusBar);
}

Create Thumbnail Images from Flash Video FLVs Folder with Bash Script

I’ve had the problem that I wanted to show a list of Flash videos in a Flex application and I want to show a sample picture of each video. As I have got only the videos stored in a folder and have no jpegs of them, I want to generate those sample jpegs, one for each video in the folder. Thus, I found quite a lot of blog entries that show you how you can create an image from a Flash video with the Open Source tool ffmpeg.

As I want to do this not for a single file but for a whole folder, I have written a bash script, that renders out a frame of each FLV video into a jpeg and saves them into a folder called thumbnails of the folder in which it is lying.
Continue reading “Create Thumbnail Images from Flash Video FLVs Folder with Bash Script”

Draw Image Reflection in Adobe Flex

Recently, I needed an image reflection effect in Flex. This would not be complicated to achieve for a Loader image object in Flash Actionscript 3 but the more for Flex as everything needs to be a bit more complicated in Flex when it comes to customizing.

Flex Image Reflection
Continue reading “Draw Image Reflection in Adobe Flex”

How to Generate Thumbnails with Adobe Air

This article from Kevin Hoyt’s blog has been a hell of a lot useful for me. It describes how thumbnails can be generated on the fly of high-res images with Adobe Air and how they can be saved to HD.

As some code is missing in Kevin’s tutorial, here is the code of two Adobe Air thumbnail generation applications.