Parsing Tweets with the TwitterString Class

While building a little Twitter aggregator for an upcoming conference, I found myself in need of a set of methods to create hyperlinks from three distinct elements that can be included within a tweet; links, usernames, and hashtags. I was able to find regular expressions to do all the heavy lifting from various sources on the Web and have created a class which pretty much does all the processing with one method call. Here’s an example of the thing working, followed by example code, and the class itself. Example SWF Flash Player 11.2 or greater is required! Example MXML 1

Continue reading »

Quick Tip: Display Application Version in your AIR App.

Just a quick tip for those looking to somehow display the AIR application version from the descriptor file. I’ve found it very helpful in troubleshooting is users can say EXACTLY what version of the app they are running. AIR 2.5 and later: private function getAppVersion():String { var appXml:XML = NativeApplication.nativeApplication.applicationDescriptor; var ns:Namespace = appXml.namespace(); var appVersion:String = appXml.ns::versionNumber[0]; return appVersion; } Older versions of AIR: private function getAppVersion():String { var appXml:XML = NativeApplication.nativeApplication.applicationDescriptor; var ns:Namespace = appXml.namespace(); var appVersion:String = appXml.ns::version[0]; return appVersion; }

Continue reading »

Simple AS3 Slideshow Widget: Part 3

This is the final post in a three part tutorial detailing the creation of a Flash slideshow widget using ActionScript 3.0. Have a look over Part 1 and Part 2 before moving ahead. In this post, we are examining the two methods which actually handle image loading and display within our module. 1 2 3 4 5 6 7 8 9 10 11 12 private function switchImage(e:TimerEvent):void { imageBitmapData.draw(this); imageBitmap.bitmapData = imageBitmapData; imageBitmap.alpha = 1; if(currentImage < imageArray.length-1){ currentImage++; }else{ currentImage = 0; } urlRequ.url = appPath + "path/to/images/" + imageArray[currentImage]; imageLoader.load(urlRequ); }private function switchImage(e:TimerEvent):void { imageBitmapData.draw(this); imageBitmap.bitmapData = imageBitmapData;

Continue reading »

Simple AS3 Slideshow Widget: Part 2

In Part 1, we had a look at the basic structure of what we are working toward, including a PHP file to read images from a directory and return a list of images to Flash, the setup of our FLA, and the basic construction of our document class. This widget, being so simple, will only require the document class. We will now go through each method and describe what is happening… 1 2 3 4 5 6 7 8 9 10 11 12 13 public function SlideShow():void { if (root.loaderInfo.parameters.appPath != undefined) { appPath = root.loaderInfo.parameters.appPath; } else { appPath

Continue reading »

Simple AS3 Slideshow Widget: Part 1

This is a simple example of how to build a dynamic slideshow widget in Flash using ActionScript 3.0 such as the one seen here. The first thing you’ll need to do is set up an FLA with the properties you’d like to exhibit. Stage resolution is set to 500×300 with a black background. This will vary depending on the size of your generated images. Be sure that your FLA is set to use ActionScript 3.0 and declare your document class, in this case “SlideShow”. Let’s set up a PHP file to read from the directory of our choosing and return

Continue reading »

Testing Flash Projects w/ Dynamic Variables

Many of the Flash modules and widgets I write are part of a larger system. Normally, some sort of ID or other variable piece of data will need to be passed in as flashvars upon initialization to allow the SWF to function correctly, making the appropriate data calls and so forth. When testing in the IDE, however, you are separated from the larger application and that data does not exist. A simple way to test such items in the standalone Flash Player is to check whether those variables are being passed in… if not- simply use your test variables. 1

Continue reading »