Simple AIR 2.0 Multitouch Sample

I was really excited when Adobe made the announcement of Multitouch support in the Flash Player. Mainly because we have a bunch of Multitouch screens hanging out in the office, from our Windows 7 Touch Games Development. We made Microsoft Blackboard, Rebound and Garden Pond. So now that it is in public beta I am able to show a really simple example of a paint program running on a Dell Latitude XT Touch Laptop. Nothing fancy, but it shows off the feature.

Simple AIR 2.0 Multitouch Example from Julian Dolce on Vimeo.

Continue reading » · Written on: 11-19-09 · 1 Comment »

AS3 SVN Library

A few months ago I started writing a svn protocol library in as3. It started with an idea for a internal tool that would allow us to select files from our svn code repository and export it and all of it’s code dependencies. And because I haven’t done a lot of work with ByteArray, or Sockets before I was pretty excited about giving this a shot. My first attempts where really rough and basic and worked for the most part, but were in no shape to be in the form of a nice library. I let it sit for a while as I was busy getting ready for FOTB and Flashpitt. Then one night I started doing some more research about the protocol and found that SVNKit, a Java SVN library, was open source. So I started going through all the source and spent a great deal of time going through how the code was structured. I couldn’t just do a straight port because of the differences that data gets returned between Java and AS3. Long story short the way they have it set up is you can make the call to the server and on the next line read the input. In AS3 you need to wait for your event to come back, and there is no guarantees that all of it is going to come back in one event either. But I was able to port some important parts like reading and writing the data. I’ve tried to keep the API’s similar, but there are instances where they just couldn’t be or didn’t make sense to. One of my goals for this project to is to make it as platform independent as possible. And by that I mean I want you to be able to use the library in the web, air, and any other Flash Player 10 player. I’ve tried to abstract out the parts that deal with writing files to disk so that this could be accomplished. But there may come a point where a feature may need AIR for whatever reason. But I’ll cross that bridge when I get to it. If that feature isn’t a super high priority chances are I will leave it out just for that reason.

That all being said I just made a fairly big commit today to the google code repository. It isn’t fully featured yet and only supports the svn:// protocol. Once I get some more of that protocol completed I plan on doing the http:// protocol. In the wiki there is an example AIR app that allows you to display directories in a tree, export files and folders, as well as trace out the log for any item in the repository.

This is still a work in progress and lots to do before it gets to a really stable state. For instance the Error handling is almost non-existent but I have placed a lot of //TODO where the errors need to be thrown. I also only have 1 svn server to test on so I am not sure how running it in other environments will work out.

I have created the library to a point where I can create our internal app, so I am not entirely sure what features I will tackle next. I may try doing commit and add, but those are fairly big. So if you have any requests I am all ears.

Continue reading » · Written on: 11-13-09 · 5 Comments »

A couple quick FDT tips

I have been using FDT for a couple of years now and I love it, but it wasn’t until recently that I started to really use it’s full potential. The biggest reason is that we still use the Flash IDE a whole lot and .fla’s are the main source of our project. Previous a lot of our projects would be 1 maybe 2 fla files and all the code would get compiled into them. We would still use FDT for all of our coding but would lose out on using the debugger which is really an amazing time saver.

So now after building the Fuel ANT Tasks, and creating a new workflow between designers and developers, we have now embracing all that is FDT. We have come up with a great solution on how to remove all of the code from our FLA’s and have it get compiled into one swf. The swf can be compiled from Flash or FDT. We create a blank fla with only a document class as our entry point, this way anybody with the IDE can compile our project. Now there are many different ways to accomplish this, so I am not going to go into them, but may post about it in the future – we are still refining the process.

The thing to take away from it is that when we are doing only code changes we can compile the code and even fla’s from FDT and have it run through the debugger. Now in order to get this running a ran into a few problems and wanted to share the solution, because it has stumped a lot of people.

Launching in External SWF Viewer
One of the options to launch your application is the External SWF viewer. This is a basic java application that displays a html page with your swf in it. The html page is generated in your output directory when you compile and then deleted when it’s complete. Because the swf is running in a local html file chances are you are going to run into security errors if you are doing any network calls, or loading of remote assets. The easiest way to get around this is to add your workspace directory to the Flash Global Security Settings panel. The path to my workspace looks something like /Users/julian/workspace, so it’s tempting to add that as a path. But because the way that the External SWF viewer is loading the swf you need to add the path like so file:////Users/julian/workspace. This will now make that directory and all it’s sub directories locally trusted locations and will not throw security errors. Be sure to check out the Run/Debug preferences in Eclipse as well for some useful settings that you may want to adjust.

Flash Player 10
I was trying to compile a project to Flash Player 10 the other day and kept getting a bunch of errors. I had added the Flash Player 10 playergloabal.swc and my swf was running in Flash Player 10 so I thought that would be enough. But it was actually compiling to Flash Player 9 still. So after much digging I found out that you need to add the following arguments to the flex sdk during compiling.


So now after a couple of weeks of trial and error on getting the whole workflow set up, I think we have a really good system in place and am looking forward to starting a new project to use it from start to finish. It took me a while to get used to the debugger and really understand it’s power, but once you do it’s an amazing time saver. No more traces just breakpoints.

Continue reading » · Written on: 11-04-09 · 6 Comments »

Thank you FlashPitt

I am at the airport waiting for my flight home to Ottawa and wanted to take the time to really say thank you to everyone involved in Flashpitt. Special thanks goes to Val, Jason, Joe, and Josh for making it such a great event. They have really done a great job in making Flashpitt one of the best flash conferences. I also wanted to thank the attendees. I was really overwhelmed by everyone who came up to me, who say my session from last year and told me that they had started playing with Arduino and Phidgets. This is really the reason why I speak at conferences and am hoping that next year when (if ?) I come back next year you will tell me about the IPhone applications you have built.

As well as spending a great day at the conference I was able to spend some time with some of my best friends in the world.

Friday night Seb, Stacey, Boris and I had to finish some work and couldn’t go out to the pre-conference party. So we sat ourselves in the lobby and had a great time singing to old 80′s and 90′s music.

Julian Dolce busting it down from BitchWhoCodes on Vimeo.

Groove in the Heart – by Seb & Julian from BitchWhoCodes on Vimeo.

The next was great as well and had a lovely dinner with Val, Seb, Jer, Scott at this restaurant called the Library. After a lovely time there we headed over to the after party at the Bicycle Bar? I think it was called. It was a really great space and meet lots of cool people. Once that party started to wind down Jer, Val, Joe and I walked over to another bar along the river. It was a pretty interesting bar with a live band. Everybody seemed to be having a good time and dancing on their chairs. We decided to join in on the fun and jumped up on a bench, but Jer went straight for the table. Apparently this is frowned upon and he was quickly escorted out of the building. It was actually quite funny and was a great way to exit the bar.

Jer, Seb and I stayed an extra day in Pittsburgh with the hopes of taking in some of the city, but Jer and I where too hungover to even really move from our hotel rooms. So we slept until it was time to take Seb to his first ever hockey game. It was great fun watching the game with him and my favorite quote of the week was “It’s brilliant watching these little men sliding around”.

Now I am close to being home and sad that the conference is over, but looking forward to my own bed. It’s been a very busy month between FOTB and Flashpitt and am looking forward to a relaxing couple of months the rest of the year.

Thanks again to everyone who attended both my workshop and session and to all of those who put the conference on. And to everyone who couldn’t make it this year, see you next year.

Continue reading » · Written on: 10-18-09 · 3 Comments »

Fuel ANT Tasks

At Fuel Industries our projects always start with a FLA, but we use FDT for all of our coding. We wanted to have a way that we could publish our projects from FDT as well as run daily automatic builds. This is easy when working with Flex because Flex has a command line compiler, but Flash doesn’t. So we wrote custom ANT tasks in Java that will allow us to publish fla’s in multiple ways.

Here are a few examples of some of the things you can do.

First you can simply compile fla’s

<target name="fla_publish">
		<fla file="${src}/redsquare.fla" build="publish"/>
		<fla file="${src}/bluesquare.fla" build="export" swf="${src}/bluesquare.swf"/>
		<fla file="${src}/greensquare.fla" build="test"/>

The fla task can take multiple different types of values for the build parameter – publish, test, and export.
publish will simply publish the file at the current settings set for the fla.
test will compile and run the swf in the Flash IDE. This is like hitting cmd-enter/ctrl-enter
export will export the swf. In order to use this mode you must specify a output swf file.

You can also publish and test Flash CS3 Flp files

<target name="flp_publish">
	     <flp file="${src}/fuelanttask.flp" build="publish"/>

If set the build mode to “test” it will look for the flp project default file and compile that project last and test the default file.
The nice thing about using the flp task is that if one of your files has a compile error, it will stop the build process and alert you of the error. This is different then the IDE as it just keeps compile the project and you won’t see if one of your files compiled incorrectly.

We have also created a task called buildnumbercommand. This task gets the local SVN revision number and inserts it into a file. This way we have the build number accessible in ActionScript and we are able to display it automatically in our files. For instance we place ours in the right click menu so our clients can see what version of the build they are looking at.

<target name="version">
	<buildnumbercommand path="${src}" />

The path parameter is the directory in which the file is located. Below is an example of

	public class BuildNumber 
		public static const BUILD_NUMBER : String = "1";

Here are some of the other parameters for the Tasks

flash task

path – This is needed on Windows only. This is the path to your Flash IDE executable and is defaulted to the default install location for CS3 and CS4. C:\Program Files\Adobe\Adobe Flash CS3\Flash.exe and C:\Program Files\Adobe\Adobe Flash CS4\Flash.exe. If you have the Flash IDE installed in these locations you can omit this parameter.

version – accepts either “CS3″ or “CS4″. The default is “CS3″. This is used to determine which IDE to compile your files in. “CS3″ is the default and can be omitted if you want to use CS3.

deleteaso – true | false will delete your aso files before compiling any files. The default is false.

closeDocs – true | false will close your fla after it’s compiled. The default is false. This is ignored when compiling a flp project and will always close it afterwards.

quit – true | false will close the Flash IDE after all the files have been compiled.

verbose – true | false has some more output messages during compilation.

fla task

file – the path to your fla file

build – valid values are “export”, “publish”, “test”. The default is “publish”.
publish will simply publish the file at the current settings set for the fla.
test will compile and run the swf in the Flash IDE. This is like hitting cmd-enter/ctrl-enter
export will export the swf. In order to use this mode you must specify a output swf file.

swf – the file path to a swf to be compiled. This is only needed when the build parameter is set to “export” and will be ignored otherwise.

flp task

file – the path to your flp file

build – valid values are “export”, “publish”, “test”. The default is “publish”.
If set the build mode to “test” it will look for the flp project default file and compile that project last and test the default file.

UPDATE : the ANT tasks have been put up on Google code. The source, examples, documentation, and the compiled jar can be found there

This is a video of me showing how to use them at Flash On The Beach during the speaker throwdown

FOTB09 – Jam Throwdown – Julian Dolce from John Davey on Vimeo.

Continue reading » · Written on: 09-23-09 · 23 Comments »

Fix Textfields JSFL

Today Seb was having some issues when dealing with embedded fonts – read his post. He came up with some ActionScript ways to get around it. Well another way would be to use JSFL. A couple of my team members at Fuel Industries wrote the following JSFL script. It goes through your library and searches out any dynamic textfields. Once it finds one it makes sure it’s on a whole pixel, turns the auto kern off, embeds “UpperCase, LowerCase, Numerals, Punctuation” characters, and makes it not selectable. But you could make it do pretty much anything you can through JSFL.

function getIsWholeInt(n)
	var s = String(n);
	if(s.indexOf(".") != -1)
		return false;
		return true;
function round(n)
	var s = String(n);
	var a = s.split(".");
	var num = parseInt(a[0]);
	var dec = parseInt(a[1].substr(0, 1));
	if(dec >= 5)
	return num;
 * Scans the supplied flash library for linked classes and makes sure the textfields are set up properly
 * @param 	library		A flash library to scan.
function scanLibrary(library)
    var items = library.items;
    var item;
	var replaceCount = 0;
    for( var i = 0; i < items.length; i++ )
        item = items[i];
		if (item.itemType == 'movie clip') 
			var timeline = item.timeline;
			var h = timeline.layerCount;
				var k = timeline.layers[h].frameCount;
					var j = timeline.layers[h].frames[k].elements.length;
						var elems = timeline.layers[h].frames[k].elements;
						var p = elems.length;
							if(elems[p].elementType == "text" && (elems[p].textType == "dynamic" || elems[p].textType == "input"))
								//Change the Static Text Fields to Dynamic
								if(elems[p].textType == "static") {
									elems[p].textType = "dynamic";
								//Handle all Dynamic TextFields
								if(elems[p].textType == "dynamic") {
									//Remove the ability to be selectable
									elems[p].selectable = false;
								//Handle all Dynamic or Input Textfields
								//Remove the auto kern attribute
								elems[p].setTextAttr('autoKern', false);
								//Embed fonts UpperCase, LowerCase, Numerals, Punctuation
								elems[p].embedRanges = "1|2|3|4";
								//Pop onto whole pixel
								var matX = elems[p].matrix;
								var x = matX.tx;
									matX.tx = round(x);
									elems[p].matrix = matX;
								var matY = elems[p].matrix;
								var y = matY.ty;
									matY.ty = round(y);
									elems[p].matrix = matY;
Continue reading » · Written on: 08-24-09 · 4 Comments »

AS3 FP10 bug

While playing with today in Flash Player 10 I found a REALLY REALLY BIG BUG. It seems that if you go to overwrite a file it appends it’s contents instead of replacing.

1. Copy and paste the code below into a blank fla in CS4.
2. Compile the swf and save a file.
3. Close the swf
4. repeat step 2
5. Open the test.txt file.

I am on OSX and haven’t tested on a PC.

var str:String = "12345";
var ba:ByteArray = new ByteArray();
ba.writeUTFBytes( str );
var fr:FileReference = new FileReference();, "test.txt");

I did a quick search on the Adobe bug base and found some related issues from 2008 but they where for downloading files from the net.

Continue reading » · Written on: 08-04-09 · 4 Comments »

One year after my first MAC

So it’s been a little over a year now since I switched to using my first MAC on an every day basis. I have used MAC’s before at school and the odd time at work, but this was my first everyday MAC. It was a hand me down from our CEO at the time, so it’s a few years old. It’s a 2.33 Intel Core 2 with 3GB of RAM MBP. Over the last 6 years I have been in the industry I kept hearing the “MAC is so much better at……” argument that I was really interested to see what all the fuss was about. So here is a list of things I like and dislike and ultimately try to really answer if MAC is so much better then all the fanboys make it out to be.

IPhone SDK
I am going to get this one out of the way first because this was the reason I moved to a MAC. We where one of the few companies who where approved vendors before the App Store went live. We had a game in the store at launch and have since released 6 or 7 games with a few more set to launch shortly. I have to say that working with the SDK and learning a new language and environment has been lots of fun. It’s really great to have something tangible to show people when they ask what you have been up to. Objective-C took a little bit to get used to but don’t mind it as much as I first did when I started. XCode however I think is one of the worst development environments that I have ever worked with. I think Eclipse and Visual Studio are far better with more features and better workflow.

Startup time
I have heard numerous times that OSX will startup faster then Windows. Well I can say that my 6 year old Toshiba laptop running XP starts up about 2 mins faster then Leopard does. Maybe a completely vanilla install will start up faster, but not after you have installed all of the plugins and helper apps that you need to install to be productive.

Ok this has to be my biggest pet peeve of all. Finder SUCKS so hard it’s not even funny. Windows Explorer is by far a better file system browser, and it continues to improve with every version of Windows. It’s ridiculous to think that the file system browser, which is by far the most important application to any OS, can be so terrible. Here are some of my issues with Finder.
1. There is no address bar. So I can’t copy and paste paths to files. The only way I can copy the path to file or folder is to open a Terminal window and drag it in there.
2. Copying or moving files sometimes doesn’t seem to go where I want them to. This is more of a focus thing than anything. Sometimes I feel like the file should get moved to a certain directory, but ends up in it’s parent. This really all depends on the view that you are in, which can be frustrating at times.
3. There is no up button. By that I mean a button that will send you to the parent folder of the currently selected folder. There is a back button, but that brings you to the last visited folder and not the parent.
4. I am not a real big fan of the Column view either. A simple tree view would be satisfactory if you ask me.

I have been using Path Finder for the last 2 weeks and I must say it is a definite improvement. However, when you are within an application and you are trying to save and open files you still have to deal with the brutality that is Finder.

Everything just always works
Again this is false. My Cannon digital camera will not mount as a disk so I can drag pictures off. So I had to go and buy a Flash Card Reader. My Garmin GPS unit also didn’t connect nicely. I was able to get it to work after a little while but it was a pain. Granted this isn’t Apple’s fault that the companies drivers aren’t supported, but either was it Microsoft’s fault that companies didn’t make drivers for Vista.

This is a little trivial, but cost me 2 hours at 2am trying to solve this issue. OSX will always use the file that is in the Trash before it uses the one on the system. For instance, if you are building an application and you are trying to fix a bug. You delete your old app, which sends it to the Trash, you compile a new version with the same name and run it but don’t see any changes. You copy it to a new machine and it works properly. Well OSX is using the old one from the Trash instead of your newly compiled bug free version, even though you launched that file. So lesson learned, always empty the Trash during development.

Fonts and Flash
This may affect more applications then just Flash but it’s the one that affects me the most. Most of our office here are on PC’s and when I get files from a designer with non True Type Fonts every text field is f’d. The position and size of the font is all off. It sometimes makes it really hard to work between the 2 platforms. Maybe this is a Adobe issue and not an Apple one, but Apple isn’t the only one on trial here.

Audio Glitch
I listen to music every day through my headphones at work using ITunes. Sometimes if I unplug my headphones or plug them in during playback I lose all audio. The only way to get it back is to restart ITunes.

Whenever I need to look at a calendar on Windows all I would do is click on the time in the system tray. So naturally when I need a calendar on OSX I click on the time in the menu bar. But it doesn’t give me a calendar. You can select Date & Time from the menu but if you have it so that it sets the time automatically the calendar is disabled and you can only see the current month. The other way to get a calendar is to open iCal, which to me seems over kill.

Unistalling applications
When you want to uninstall an application it can be as easy as just dragging the .app into the trash. But what if I wanted to uninstall Flash? It installs more then just the Adobe Flash CS3/CS4 folders in your applications directory. There are installers in /Applications/Utilities/Adobe Utilities/ that you can use but is that really that intuitive? OSX is supposed to be the OS with superior user experience. A global add/remove applications would definitely be a good thing to have.

Going to the Desktop
In Windows I often would use the Windows-D shortcut to minimize all windows and show the destkop. This was really handy for getting access to files quickly. The only way to do this on OSX is to click on Finder and then hit CMD-ALT-H to hide all other windows. It’s not that bad but it’s an extra step. You can also hit F11 to minimize all the windows to reveal the Desktop, but as soon as you click on a file they all come back which is super annoying.

Exposes and Spaces
While we are on the subject, I find these features useless. I tried using this for a couple of months but quickly found that they got in the way more then they actually providing a better user experience.

There are not a lot of great options for Subversion integration. The integration into the context menu isn’t full featured like TortoiseSVN is on Windows. I have tried Versions and it’s not bad, but have had issues with it locking files on me unexpectedly. The best that I have been able to find is using Subclipse the Eclipse plugin. It has a great Repository Browser and fits into my development workflow for 99% of my projects. The other 1% is when I am in Xcode, which has terrible SCM integration.

OK Terminal is awesome. It is by far better then the Windows Command Prompt. You can drag and drop files into it, it has a vi editor built in, which I still suck at but getting better, and overall it feels like an application and not a tool. If that makes any sense.

I have to say that working on a Unix machine has been a great learning experience. You get to learn a lot of things that you would normally not learn unless you where on Linux. Having Apache pre-installed is nice as well. Learning Unix commands and shell scripting has been lots of fun. If you have ever worked with me before, or been to one of my talks, you will probably know that I am constantly looking at optimizing workflow and efficiency. So I have been a busy scripter to say the least.

Screen Sharing
Screen sharing between OSX machines has been really convenient. Our IPhone development team works remotely in Denver and it has come in handy a few times. Also, our IPhone and Flash build machine is a Mac Mini. Being able to restart or install applications has been easy just by using Screen Sharing. If I was working in Windows, we would just be able to remote desktop in to the machine, which is essentially the same thing, but for some reason screen sharing feels easier.

One of the applications that I miss most from Windows is charmap – or Character Map. This application shows you all of the characters that are included in a particular font. This comes in handy when you are developing for multiple languages and you have to make sure that a font has all the necessary characters. I haven’t found a great way to figure this out yet on OSX. The best way that I have found is to open Extensis Suitecase, type in all of the characters that you need in the box on the top right and then select the font to preview it. If a character isn’t supported in that font it will be displayed as a rectangle. Not really ideal but it will have to do I suppose. If anyone has any tips on this I would love to hear them.

Spotlight is a great search tool for the desktop, but so is the new Vista search. That’s pretty much all I have to say about it.

UI Design
The UI Design is by far better then most Windows applications. I never really understood why until I built a Cocoa app and realized that all of the Cocoa components are designed really well. Apple makes it easy for developers to make their applications meet the Apple UI Guidelines, which gives apps a consistent look and feel. If you look back at the old Visual Basic and Windows Forms components you will see why OSX has always been considered to have better UI. The new Vista and Windows 7 components, WPF/XAML, are a massive improvement, but they still lack a certain polish and maturity to them compared to the Cocoa ones.

Uggg. Where to even begin. When your office is primarily a Windows shop, and you use Windows Exchange Server you don’t have much choice then to use Entourage as your mail client. Outlook is by far the best email client that I have ever used and I am not sure why Microsoft couldn’t just make a OSX version of it, instead of the grossness that is Entourage. Luckily Snow Leopard is coming to the rescue this fall and Mail and ICal will have Exchange support. I do however find it a little weird that there is 3 separate apps for Mail, Calendar, and Contacts. To me it makes so much sense to have them all in one. But time will tell once I start using them on a daily basis.

USB ports
There are only 2 USB ports on my MBP and it drives me crazy. My old Windows laptop had 4, which didn’t increase the size at all. I am basically stuck with carrying around a USB hub as I travel if I want to use a mouse.

I know all of this sounds like I hate my Mac, but I don’t. I am looking forward to getting a new Laptop and a iMac for the house as well. I think people are convinced easily that Mac’s are superior machines, when they are really just more of the same. You do get more for your money with a Windows machine. I don’t think one machine is better then the other and it really comes down to personal preference. The hardware design is by far the best however, but it’s a little pricey. I am sure there will be Fanboys out there that will disagree with most of this post, but they are the same people that stood in line at the Grand Opening of the Apple store this weekend in Ottawa. I am not sure what the big fuss is about. Best Buy sells the exact same stuff for the exact same price, because Apple hardware never goes on sale. Anyways

Continue reading » · Written on: 07-19-09 · 6 Comments »

2 Sparkfun’s 7-Segment Red 6.5? Display and Arduino

A few weeks ago I posted about connecting Sparkfun’s 7-Segment 6.5″ Display’s to Arduino. In that post I only showed how to hook up 1 digit. In this post I will show how to hook up 2, but it scales to however many you want to add. Much of the same applies from my previous post but here are new diagrams and code.

int dataPin = 11;
int clockPin = 12;
int latchPin = 8;
int len = 10;
//holders for infromation you're going to pass to shifting function
byte dataRED;
byte dataArrayRED[10];
byte off = 0x00;
byte decimalpoint = 0x80;
void setup() {
  //set pins to output because they are addressed in the main loop
  pinMode(latchPin, OUTPUT);
  //Arduino doesn't seem to have a way to write binary straight into the code
  //so these values are in HEX.  Decimal would have been fine, too.
  dataArrayRED[0] = 0x3F; //00111111 - 0
  dataArrayRED[1] = 0x06; //00000110 - 1
  dataArrayRED[2] = 0x5B; //01011011 - 2
  dataArrayRED[3] = 0x4F; //01001111 - 3
  dataArrayRED[4] = 0x66; //01100110 - 4
  dataArrayRED[5] = 0x6D; //01101101 - 5
  dataArrayRED[6] = 0x7D; //01111101 - 6
  dataArrayRED[7] = 0x07; //00000111 - 7
  dataArrayRED[8] = 0x7F; //01111111 - 8
  dataArrayRED[9] = 0x67; //01100111 - 9
void loop() {
int count = 100;
int val = 10; //this is for how many digits
for( int i = 0; i<count; i++ )
  digitalWrite(latchPin, 0);
   int digit2 = i % val;
  int digit1 = ( i - digit2 ) / val;
    shiftOut(dataPin, clockPin, dataArrayRED[ digit2 ]);
    shiftOut(dataPin, clockPin, dataArrayRED[ digit1 ]);
  digitalWrite(latchPin, 1);
// the heart of the program
void shiftOut(int myDataPin, int myClockPin, byte myDataOut) {
  // This shifts 8 bits out MSB first,
  //on the rising edge of the clock,
  //clock idles low
  //internal function setup
  int i=0;
  int pinState;
  pinMode(myClockPin, OUTPUT);
  pinMode(myDataPin, OUTPUT);
  //clear everything out just in case to
  //prepare shift register for bit shifting
  digitalWrite(myDataPin, 0);
  digitalWrite(myClockPin, 0);
  //for each bit in the byte myDataOut…
  //This means that %00000001 or "1" will go through such
  //that it will be pin Q0 that lights.
  for (i=7; i>=0; i--)  
    digitalWrite(myClockPin, 0);
    //if the value passed to myDataOut and a bitmask result
    // true then... so if we are at i=6 and our value is
    // %11010100 it would the code compares it to %01000000
    // and proceeds to set pinState to 1.
    if( myDataOut & (1<<i) ) 
	pinState= 1;
	pinState= 0;
    //Sets the pin to HIGH or LOW depending on pinState
    digitalWrite(myDataPin, pinState);
    //register shifts bits on upstroke of clock pin
    digitalWrite(myClockPin, 1);
    //zero the data pin after shift to prevent bleed through
    digitalWrite(myDataPin, 0);
  //stop shifting
  digitalWrite(myClockPin, 0);

I also have a video uploaded on viddler

Now that I have this up and running I just have to do something useful with it. And I have to find a better way to solder the digits, because there are wires everywhere.

Continue reading » · Written on: 06-19-09 · 13 Comments »

Automatic Builds Presentation Reference Links

Here are some reference links for my presentation.

Installing Subversion on OSX


Flash ANT Tasks

Flex ANT Tasks docs


sample Flash build.xml

<?xml version="1.0"?>
<project default="all" basedir=".">
	<condition property="flash" value="">
		<os family="mac" />
	<condition property="flash" value="C:\Program Files\Adobe\Adobe Flash CS3\Flash.exe">
		<os family="windows" />
	<property name="dev.dir" value="/Library/WebServer/Documents/sceneit" />
	<property name="fla.dir" value="${basedir}/src" />
	<property name="swf.output.dir" value="${basedir}/bin" />
	<taskdef resource="" classpath="FlashAntTasks.jar"/>
	<target name="all" depends="version, compileflash, uploadtodev" />
	<property name="src" location="Classes/com/fuelindustries" description="Fuel library path" />
	<target name="version">
		<exec executable="svnversion" output="temp.txt">
			<arg line="-n" />
		<replaceregexp file="temp.txt" flags="gs" match="([0-9]+)(:)(.*)" replace="\1" />
		<loadfile srcFile="temp.txt" property="revision" />
		<replaceregexp file="${src}/" flags="gi" match='BUILD_NUMBER : String = "[0-9A-Za-z]*"' replace='BUILD_NUMBER : String = "${revision}"' />
		<delete file="temp.txt" />
	<target name="compileflash">
		<flashcommand flashapp="${flash}">
			<movie export="true" source="${fla.dir}/prototype.fla" output="${swf.output.dir}/prototype.swf" />
	<target name="uploadtodev">
		 <copy todir="${dev.dir}" overwrite="true" >
   			 <fileset dir="${swf.output.dir}" />
Helpful tasks
Copying a whole directory	
<copy todir="pathtonewdir" overwrite="true" >
	<fileset dir="dirtocopy"/>
Getting the current date stamp
<property name="now" value="${DSTAMP}-${TSTAMP}" />
Creating ASDocs
<exec executable="asdoc" failonerror="true">
    <arg line="-source-path Classes -doc-sources Classes/" />
Updating SVN
<exec executable="svn">
	<arg line="update trunk -r HEAD" />
<movie> Task properties
closeDocAfterComplete = false;
closeFlashAfterComplete = false;
publish = false;
testMovie = false;
saveAndCompact = false;


package com.fuelindustries 
	public class BuildNumber 
		public static const BUILD_NUMBER : String = "7M";
Continue reading » · Written on: 06-09-09 · 1 Comment »