Archive for the 'iPhone' category


Apr 14 2011 Published by under ActionScript, Components, Flash, iPhone

Doing some Android dev these days. Needed to check if a editable text field was empty or not. I had to dig around to find out how to do this. It turns out that an EditText’s getText() method returns an instance of Editable. You need to convert this to a string and then call equals(“”) on it. So you get this:

[php lang=”Java”]if(myText.getText().toString().equals(“”)) {…}[/php]

The similar thing in Objective-C would be:

[php lang=”C”]if([[myText text] isEqualToString:@””]) {…}[/php]

And in ActionScript:

[php lang=”AS3″]if(myText.text == “”) {…}[/php]

I’m going to hold my tongue here, and let you make your own judgments. But as a person who created MinimalComponents, I bet you can guess where my preference lies. 😉

37 responses so far

SWFSheet – create sprite sheets from SWFs

[EDIT: Just released a beta of SWFSheet 1.1 here:]
[EDIT: Version 1.1 final released:]

SWFSheet is a program I created in most of a day back in late December. I finally polished it up this week and it’s now ready for release. The idea is to take an animation created in Flash, and generate a sprite sheet from it. A sprite sheet, for those of you who may not be familiar, is a single large bitmap containing several frames of an animation, usually layed out in a grid. These can be loaded in very efficiently by games, and each frame shown to recreate the animation.

I had the idea for this program while attempting to port some Flash stuff to the iPhone. And later while making other mobile games, I found that Flash was still the best tool to create animations. It has a powerful time line, easy to use drawing tools, tweens, 3D, and of course, powerful scripting with ActionScript. However, getting a nice looking Flash animation into a sprite sheet that could be used with cocos2d on the iPhone/iPad or with XNA for Windows Phone 7 was not so easy. I did it by hand a couple of times, and it wasn’t very fun. Thus, SWFSheet was born.

SWFSheet is an AIR application and has been tested on Windows and Mac. You create your SWF however you want. Flash CS5 or earlier, Flash Builder, or anything else that outputs a SWF. It doesn’t matter how it’s created. Then you load the SWF into SWFSheet.

swfsheet screenshot

Immediately, you’ll see the live loaded SWF running in the upper left panel. The program will then capture an image of the SWF on each frame for the number of frames you have specified (default 15) and arrange them in a grid on the bitmap. Once that is done, it will then animate this bitmap using the same techniques you would use to animate a sprite sheet in a real game. This is seen in the lower left panel. You can adjust how many frames you want to capture to make sure you get your whole animation and have it loop smoothly. And you can adjust the frame of exactly how much area is captured in each frame, to maximize space on the bitmap. If there is not enough space to capture all frames, you can choose a larger bitmap. After any changes, you need to click “Capture” to re-capture the frames based on the new settings.

Often when scripting animations, you will have various transformations or other changes happening in an onEnterFrame type of loop. This can sometimes cause a glitch, as the first frame is captured before the first enterFrame handler fires, and thus does not have the initial transformations applied. There is a “Skip first frame” checkbox which handles this situation. There are also options for smoothing, which may or may not make any difference in a specific animation, and for transparency. By default, a loaded in SWF will have a transparent background, but you can override this to make an opaque bitmap with any color background you want. And you can change the preview frame rate – of course this doesn’t change the bitmap at all, but can give you an idea what your animation will look like at your target frame rate.

Note that there are a limited number of sized of bitmaps. Sprite sheets can almost always take advantage of extra efficiency when created in power-of-two sized squares – 64×64, 128×128, 256×256, etc. Thus, these are the only choices. A future version may make possible custom sizes if enough people ask for it.

Here’s the AIR installer:

SWFSheet Installer

And here are some test files to get started with:

Test Files


ps. Another tool you might be interested in is Mike Jones’ Sprite Sheet Maker, which is more geared to making sprite sheets from a series of separate image files. Similar outcome, different use cases, depending on what kind of input you are starting from.

76 responses so far

Good bye 2010

As usual, it’s time to make my year end post. I’ll keep it relatively brief.

A few changes this year. This spring, I got kind of fed up with Apple, their control-happy policies, and the general direction they are heading. After 3 years of being 100% Mac, I switched back to Windows. It is an action that I not only do not regret the tiniest bit, but as Apple continues to evolve in the same direction, I’m happier than ever that I switched when I did. This is not to say that I’ve abandoned all iOS development and have thrown away my Mac. I still own two Apple computers. Both are plugged in and booted up and ready for action at all time. I have an iPhone, and iPad, an iPod Touch and a 5G iPod. They aren’t going anywhere. But the machine I open up in the morning and use all day long is my Sony Vaio, and I’m very happy with it. I’m not shoving it down your throat. If you’re happy with Apple, far be it from me to try to change your mind. I’m OK, you’re OK, right?

Around the same time I switched back to Windows, I also came into the ownership of a Google Nexus One. It took a while to really get used to it, as it’s definitely not the polished experience that the iPhone is. But I forced myself to stick with it for a week or so and really started to love it. From my viewpoint, the main difference was that it was MY phone, not Steve Jobs’. I could do pretty much whatever I wanted with it. Change the lock screen, change the task switcher, add memory, change the battery, put my icons where I want them, install unsigned apps, have live gadgets on the home screen, etc. etc. Once I got used to it, the iPhone just seemed unbearably sterile. Unfortunately, the model I had was a T-Mobile version, so I couldn’t get 3G on it with my AT&T sim. I suffered with Edge for a several months, but finally the wifi connection and even the Edge connection started getting really flaky. One day in September, just couldn’t connect to anything, so it was back to the iPhone.

Coming back to the iPhone, I have to admit, I really did appreciate the slickness of the UI. But I didn’t fall back in love with it. To be honest, I knew it was only a stopgap until the new Windows Phones came out. I got a Samsung Focus as soon as they came out and I absolutely love it. It is without a doubt the best phone I’ve owned. Note – it’s far from perfect. It’s a v1 product and it shows in many ways. But regardless of all that, there is so much RIGHT about what Microsoft did with it. I’m really excited to see where it goes in the coming years. I don’t expect it to overtake or even match Android or iOS any time in the near future, if at all, and I don’t really care. As long as I can continue to own one and see it improve, I’m a happy camper.

As for mobile development, I didn’t do much at all most of the year. But this autumn and winter I worked on one major and one minor iOS projects at Infrared5. After being away from Objective-C for so long, it was pretty bizarre trying to get back into it. It took a couple of days before it stopped feeling like I was typing with my toes, but eventually I got back in the groove. I played with Android dev briefly, but never really dove into it that much. But in October, I got my hands dirty with Windows Phone dev, with both XNA and Silverlight, and it has blown me away. I might even say it’s revitalized me as a developer. For a large part of the year I was on a very tough, frustrating project. It wore me down quite a bit. But with Visual Studio and C#, it’s like starting from scratch – in a good way! All the excitement without the learning curve. After many years of Flash development, writing ActionScript is almost second nature to me. But after just a couple of months in Visual Studio, I feel like I’m more at home with C# than I ever was with ActionScript. It’s a very, very similar language. If you took AS3 and removed all the little things that annoy or distract you and pull you out of the “flow” of coding, and replaced them with a whole bunch of little things that just work exactly the way you would expect them to, you’d have C#. And if you took Flash Builder and … no, that’s just not going to work. There’s no comparing Eclipse to Visual Studio.

Speaking of IDEs, after working in VS for a few months, and then going back to XCode… it really dawned on me just how bizarre an IDE that really is. I’m really trying not to bash any particular technology, but I can’t help feeling like XCode was designed on an anti-matter planet in an alternate universe by some bizarre aliens on really strong acid. I’m not even talking about the language – just the IDE. I sometimes find it hard to believe that it was created by and for programmers. I know it’s not “wrong”, just different. Most IDEs are relatively similar, like most western human languages are pretty similar. I may not speak Spanish, but I can see it and read the words even if I don’t know their meaning, and can catch a bit of a hint of what’s being said. Same with most IDEs – you can quickly find your way around them for the most part. But diving into XCode is like being dropped in an Asian or Middle Eastern country where everything just looks like random scratchings or scribbles to your unfamiliar eye. That’s what XCode is like – just a completely foreign programming paradigm. Again, not saying it’s bad or wrong. You live with it long enough and you become fluent in it. But boy is it different.

Also in the summer I got into Processing quite a bit. Far more than I ever had before. I’ve kind of drifted from it again, but it was a great experience. I’m sure I’ll drift back around to it again before long. This largely came about from my conference session for 2010, “Programming Art”, in which I covered a bunch of different tools and languages for creating algorithmic and generative art, including Context Free Art, Structure Synth, Processing, the Hype Framework, and others. I also really enjoyed getting my head around Structure Synth, and got a bit revived on it just recently with the newly released integrated raytracer. Fun stuff!

On a personal basis, it was a year of health. I ran over 1000 miles, lost a good deal of weight, and reverted the trend of my blood sugar and blood pressure, which were edging into borderline problem areas. I think I also did more travelling this year than I have in any previous years, with trips to San Francisco, Minneapolis, Kortrijk Belgium, Toronto, Japan, back to San Francisco, and Edmonton.

Well so much for keeping in brief. In summary, it was a year of trying new things and going back to old things, learning new platforms and languages. Going forward, I don’t think it’s possible, at least not for me, to be a “Flash Developer”, or an “iPhone Developer” or be stuck in any single platform. Now more than ever, there is just too much diversity and you have to have a foot in every camp. If someone needs a game or an app these days, they can’t really just release a single version of it. They’re going to need an iPhone version, and Android version, eventually a Windows Phone version, and some kind of web presence with it. Are you going to just ask for one slice of that pie? Are they going to farm out their app to 4-5 different shops, one for each platform? As a company at the very least, you need to be able to do it all. Ideally as a developer as well, you need to be able to do as many of those as possible. I know that’s where Adobe is trying to be strong with the iPhone and Android packagers for Flash. I’m still not convinced those are the solutions for most projects though. Native will always win.

As for 2011, I assume the fist good chunk of the year I’ll be doing a lot more WP7 dev. And since the XNA codebase is 99% the same for WP7, Windows, and XBox games, I look forward to releasing some stuff for Windows desktop and XBox as well. I’m sure I’ll also play with the new Mac App Store stuff, and more iOS stuff too. The WP7 game I’m working on now will definitely need an iOS port. But who knows where I’ll go from there?

8 responses so far

Apple Crumbles on 3rd Party Tools

Sep 09 2010 Published by under Flash, iPhone

This just in, though the Twitterverse probably makes this old news already…

Apple has just announced that it is “relaxing all restrictions on the development tools used to create iOS apps”. In other words, it looks like the Flash CS5 iPhone publishing flow is now actually usable. Full announcement here:

The only mentioned restriction is the requirement that the “resulting apps do not download any code”. I’m pretty sure the CS5 flow doesn’t cross that boundary.

Didn’t see that one coming. OK Adobe, now update that bad boy so we can make iPad apps. I see some cool stuff coming.

29 responses so far

Kindle and iPad Displays: Up close and personal.

Aug 12 2010 Published by under General, iPhone, Kindle, Uncategorized

This really isn’t meant to be a contentious post. It really only came about because I got a new toy, something I’ve been wanting to get for a while – a USB microsope! Here’s the model I got:

Veho VMS004 DELUXE USB Powered Microscope

The family had great fun playing with it tonight – looking at everyone’s skin and hair and dirty fingernails and bug bites, and paper and money and cloth and salt and sugar, etc. I could barely pry my daughter away from it. The software allows you to capture images and videos and even notate them with actual measurements, etc. based on the level of magnification.

While playing a bit more with it, I held it up to my computer screen and my Nexus One screen and could clearly see the pixels. Neat. Then I wondered what the Kindle’s screen looks like close up. Quite different! I then compared the Kindle’s screen at roughly 26x and 400x with the iPad’s screen at approximately the same resolution. Wow! No wonder the Kindle is so much easier to read!

First at about 26x.



And now at about 400x for the Kindle and 375x for the iPad.



The Kindle’s screen looks almost organic at high magnification. I need to learn more about eInk now. I will hopefully be getting my Kindle 3 in a couple of weeks (should ship August 27). I’m interested to see how that shows up – supposedly the contrast is much better. And now I need to get my hands on a iPhone 4 with that retina display. I’d love to see what that looks like close up. Not buying one though. Maybe someone at FiTC San Francisco will have one they can lend me for a photo.

[Update 8/13/10]

As requested, here are some additional photos at 26x and 400x, of print media.

First, newsprint, then a magazine, then a paperback book at 26x.




And now the same three, in the same order, at 400x:




Again, I leave it to you to make your conclusions.

[Edit #2]
I changed the post title to remove the “vs.”, replacing it with “and”. This is not a battle, people. Just some interesting photos. Relax. It’s all going to be OK.

428 responses so far


Jul 02 2010 Published by under General, iPhone

I made a funneh:

I’m not trying to be an Apple hater, but this letter just cracked me up.

13 responses so far

Falling Balls Rising

Jan 05 2010 Published by under iPhone

So my iPhone game, Falling Balls, has been out for almost a year. In the first few weeks it was out, it rose to be the #1 free application on the iTunes App Store. Trust me, this surprised nobody more than it did ME. It stayed in the top spot for a day or two, maybe more, I forget exactly, then started slowly sinking down the chart. But it sank quite slowly. I think it stayed in the top 100 for something like a few months. And even after it was out of the top 100 free apps list, it was still hanging in there in the top 100 free games list. Of course, all good things come to an end, and eventually it went out of site.

Until now! Yesterday, somebody tweeted a link to this review:

Now you can’t ask for a better review than that. I read it, smiled, got a nice ego boost out of it and got back to work.

Cut to this evening. I get home, I’m relaxing in my chair, my iPhone is sitting there beside me. I get one of those bored moments where I think, maybe I’ll download a fun little iPhone game. I figure, let’s see what free games are available first, maybe I’ll luck out and get something fun for nothing. I open the “Top 25 Free Apps” page, and to my astonishment…

Yes, Falling Balls is the #2 free application! Amazing.

10 responses so far

Another year…

Dec 31 2009 Published by under ActionScript, Flash, General, iPhone, Objective C, Technology

For the past few years, I’ve posted a review of the previous year and a look to the coming year. So, I’ll do it again.

2009 was a very interesting year. Like this year, last year I had a whole bunch of unused vacation time at the end of the year, so took a couple of weeks off over Christmas. I decided to dive into Objective-C and iPhone programming. Little did I know how much that would dominate the next year, both in terms of my personal projects and work projects at Infrared5. One of the very first things I did was a little game called “Falling Balls”. A stupid little thing where you tilt the phone right and left to avoid … well … falling balls. It was just a silly thing I did in about 1.5 days, mostly to get a handle on the language and writing games in Objective-C. Unbelievably, the game rose to be the number one free application on the iTunes store. I put some ads in it and the cash started pouring in. I mean, more money than I could believe. Of course, it had its peak and eventually slid down the chart and made less money, but even now, it’s doing amazingly well in terms of ad revenue.

Hitting it big like that was a blessing and a curse. All I had to do, I figured, was do a handful of apps like that a year, and I could retire rich, buy an island somewhere and … ok, back to reality. Seems I wasn’t the only one who got the idea of making it big in the app store. I released a bunch of other apps – some free with ads, some paid, some lite/full version, etc. All told, the total amount I’ve made via all my other apps is equivalent to about what I currently make in a single day on Falling Balls. So, I’ve pretty much given up on striking it big AGAIN with iPhone apps, but will continue to give the occasional tweak to Falling Balls to keep it active.

At Infrared5 as well, we hitched up to the iPhone bandwagon. It wasn’t hard. All we had to do is say that we did iPhone stuff and after that pretty much everyone coming to us wanted us to do iPhone apps for them. I did one Flex job early in the year, but since then it’s been pretty much flat out iPhone projects for clients.

A lot of people have actually been upset with me for “abandoning” Flash here. I’m not even going to defend myself on that one. I pretty much did abandon Flash for quite a while there. I can’t say I’m diving back into it both feet at the moment, but I did get pretty burnt out on the iPhone stuff as well. Still working on iPhone stuff at work, but don’t have any ongoing personal iPhone projects at the moment, or any solid plans for any. I love the platform and hardware and capabilities and even got to love the language. But I hate the business model and publishing stranglehold that Apple has on it. In Flash I can bang out a SWF, put it on my site, blog or tweet about it, and in minutes, the whole world can see it. With the iPhone, I have to submit it, wait some unspecified amount of weeks with no feedback or anyone to communicate with, to see if it is approved or not. If not, no real recourse. Just fix it and put it back into the queue. It’s awful.

So what now? Back to Flash? Possibly. As you may have noticed, I had a whole game programming thing going on there a few months ago. Did a whole bunch of research on game architecture, applying it all to Flash games, spoke about game architecture at Flash on the Beach, and promised a game framework/toolkit “Asobu” that I was working on. Not sure what really happened with that.

In fact, for about the last month or so, I’ve hardly done any coding at all in my own spare time. Of course, I’ve been doing plenty at work, and that’s going fine. But usually when I get home, I have some personal stuff I’m working on – a game, some generative art, some experiments, components, a book, or whatever. But lately, I don’t know. I just get home, eat, relax, read some, hang out with the family, light up the wood stove and relax. I’m not particularly worried about it, and you shouldn’t be either. I think my mind just needs some time to recharge. I’ve been going at this pretty hard core since 2001 anyway. Consider I’m on a mini-personal-sabbatical. You might have noticed the dearth of posts here in the last several weeks. In fact, this is the first post I’ve done this month. I’m not going to make any promises about how I’ll now kick everything back into gear and get going on stuff again, but I have no doubt I’ll get fired up again sometime soon. I’ve learned to trust my instincts. They’ve done well for me thus far, and right now they are telling me to chill out. 🙂

One thing that I’ve given a lot of attention to in the last few months is running. I started up the Couch to 5K program to get in shape at the end of last August, and now I’m running 5 days a week. I’m completely addicted. Reading lots of running magazines and books and sites. Naturally, I’m getting all geeky about it with GPS and heart rate monitoring and tracking applications, etc. In fact, it has taken over my other, “personal” blog at If you are ever in doubt as to whether or not I’m alive, you can always check there and see what’s up.

But I haven’t been totally code free. In fact, I have actually been doing some ActionScript projects, particularly over this little vacation I’ve been taking. Tying in with the running, I started parsing the raw output of my Garmin Forerunner 305 GPS running watch – parsing the XML and graphing it out in interactive 3D. So much better than any of the apps that map the route on a google map and give you a 2D chart underneath it showing speed, elevation and heart rate. I plan to continue working on that over the next few weeks and have something to show. Also, I revived a cool project I’d started a long while back using the Flash 10 sound synth stuff. Been working on that actively the last couple of days. I actually started getting very excited about the possibilities of that, so that may be the next major thing you see coming out of this place.

What about overall 2010 plans? Can’t really say just yet. At work, we are starting in on a very major, and very … unique project that would possibly be done in Unity 3D. So I may be diving into some C# work for that. And beyond the Flash projects I just mentioned, I’m really interested in learning some other experimental technologies. I started playing with Structure Synth a while back, which is very interesting. A whole new take on programming. Hard to wrap your head around the syntax at first, but produces some stunning pics. I also want to dive more into some things like NodeBox, Context Free, ToolBox, Processing, and Open Frameworks.

Beyond that, like I said, just going with my intuition. And I intuit that 2010 will be a good year.

7 responses so far

RoboDancer is up!

Nov 12 2009 Published by under iPhone

After only 11 days in approval, RoboDancer has hit the app store. I guess it pays to write blog posts about long waiting times. 🙂

Check it out here

One response so far

RoboDancer! Coming Soon to an iPhone near you.

Nov 07 2009 Published by under iPhone

This is really nothing but a fun app that I had a fun time making. It hearkens back to a small Flash piece I saw on the web close to ten years ago (which you can see here).

Basically, you have a robot on your screen. Fire up some music and start clicking and dragging to change the way the robot dances. Or shake the device to come up with a random dance. There are 10 interchangeable heads, tops, bottoms, and sets of hands, meaning 10,000 possible different robots, plus a few different backgrounds.

6 responses so far

Older posts »