Archive for the 'Flash' category

Flash and Me

Apr 23 2014 Published by under ActionScript, Flash

Today I tweeted a link to another stupid linkbait article proclaiming that Flash is dead. Of course, this set off a huge flurry of tweets about whether or not Flash is still breathing. And it made me realize that I haven’t made my current position on Flash very clear.

The fact is that I have no longer have any interest in Flash or ActionScript as a platform or language. While I did do some work with ActionScript and mobile AIR development while I was at Disney, I don’t think I’ve done any personal Flash development in two or three years. I don’t have Flash Authoring or Flash Builder or any other Flash development tools on any of the computers that I currently use.

But I’m not a Flash hater. I know a lot of people who jump started their development careers with Flash and have moved on and now rant and rave about how horrible it is and always was and how much they hate it now. I’m not in that camp. I have lots of great memories about Flash – both the technology and the community that it created.

So why did I jump ship? Short answer, I don’t see it as a viable, evolving technology for the future. That’s not the same as it being dead though. I look at it more that Flash has gone into retirement. Now, people who go into retirement are not dead. Many continue to have long, healthy, happy lives for decades to come. Some continue to do many productive things, have great experiences and learn new skills. But generally speaking, they’re not graduating college and looking for a new job to start their career. They’re winding down.

That’s where I see Flash. It had its Golden Age, and it was awesome. I’m super happy that I was a part of that. But that’s over. That doesn’t mean that it’s dead. In fact, Flash still does all the stuff that made it awesome, and does it as well as it ever did. It even continues to get some new features. And you can still use it for all that stuff. And many people still do, and they make a living at it, and likely will continue to be able to make a living at it for some time.

But, as I said, it’s not a viable, evolving technology. Looking at my years as a Flash developer, I started out with Flash 4. Flash 5 had groundbreaking changes and improvements. Eighteen months later, Flash MX blew everyone away with new features again. Flash MX 2004 gave us ActionScript 2.0. The next bunch of improvements get a bit hazy due to the player versions getting out of sync with the authoring versions, but we got BitmapData and crazy audio and video improvements, ActionScript 3.0, Flex, Flex/Flash Builder, Flash Catalyst, basic 3D and then Stage3D, and on and on.

But in the last few years, there has been nothing like that. Yes, Stage3D continues to get improvements, and AIR continues to get updates. And there are things here and there, but as an overall ecosystem, I feel like it’s largely in maintenance mode. I know people will deny this and start posting long lists of recent updates and improvements. But you can’t tell me that Adobe is anywhere near as committed to the future of Flash than it was 10 or even 5 years ago.

Where is Flex? Where is Flash Mobile? Where is Flash Catalyst? Where is any sign of Flash on Linux? (hint: gone, gone, gone and gone.) What is in store for the next version of ActionScript? (hint: there is no next version of ActionScript planned.) What improvements are upcoming for Flash Builder? (hint: none.) How many people were on the Flash team a few years ago and how many are on it now? (hint: fractional.) How is the Flash Platform monetized? (no hint. no clue.) How many people do you know who were full time Flash developers 5-6 years ago who don’t Flash at all now? (hint: a LOT.) How many of the numerous Flash conferences from 5-10 years ago are still held, and have not changed their name to exclude the concept of Flash? (hint: zero.)

I know I’m now sounding like a Flash hater, but I’m really not. These are all just facts. Adobe is committing a small fraction of the resources it used to to the Flash Platform. It has cancelled most of the projects and products related to the platform. Almost every person I know who worked on the Flash team back in the day has either left, been laid off, or has moved onto other projects. Most of the Flash developers I know personally from years ago are now doing iOS, HTML/JavaScript or other development – exclusively in most cases.

Now, I know people are going to come on here and tell me how great Flash still is. Yep, I already said that. They’ll say that it is still innovating with new features. I covered that. They’ll talk about how great it is for games. No argument. Then they’ll go onto say how much HTML and JavaScript sucks. They’ll say how you can’t make apps with it and you can’t make games with it and you can’t really do anything with it because it isn’t strictly typed and doesn’t have private vars audio support sucks and blah blah blah. I’m not going to respond to those people. Only going to roll my eyes and feel a bit sad for them.

Long, long before I was into development, long, long before most of you were into programming either, I knew a guy who was a programmer. An MIT graduate. He was really proficient in some particular language being run on some particular system. I can’t tell you what language or system because at the time, I couldn’t tell you the difference between C and BASIC. But he was one of the best at this system. He had this great, really well-paying job doing it. He worked there for years. Had it made. Then the company upgraded to a new system with a new language that he knew nothing about. So he was out of a job. And he went to look for a new job. And he realized that absolutely nobody used that old system or language anymore. He was so confident and complacent at his old job that he never bothered to learn any new language or system. Now, all his skills were completely obsolete and he could not get a new job. I think he wound up doing data entry somewhere. This is not a made up fable. This was a real guy that I knew well. I don’t want to be that guy, so every once in a while I put aside my likes and biases and take an honest look at the landscape around me and decide where technology is going so that I don’t paint myself into a corner. And that’s why I stopped doing Flash.

90 responses so far

Syntax

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:

if(myText.getText().toString().equals("")) {...}

The similar thing in Objective-C would be:

if([[myText text] isEqualToString:@""]) {...}

And in ActionScript:

if(myText.text == "") {...}

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

Ubuntu and Me, Happy Together.

Feb 02 2011 Published by under ActionScript, Flash, General, Technology

I tweeted today about this being my second full day on Ubuntu and it a bunch of responses from people wanting to know how I did this or that, what my experience was, etc. So here’s the story.

For a while, I’ve been wanting to set up a home server. For backups, file storage, and to learn a bit more about server administration and server side programming. It’s a big gap in my knowledge base. I also wanted to get back into Linux. I’d fist messed around with Linux back in the mid 90’s, downloading RedHat onto something like 18 floppy disks via a 14.4 modem in order to install it. Back in the good old days when you had to install your own window manager and configure it by editing config files. I know you can still do that, but back then it was the only way to do it. Finally, I wanted to get back into hardware. From my very first PC (after graduating from a Commodore 128 and Amiga 500) up until my first laptop, I had built all my own PCs from scratch. I’d start with some cheap or free used PC and upgrade it bit by bit until it was a nice machine. It would often wind up with some friend or family member and I’d start over.

The Linux portion of this whole thing got rekindled recently, in my switch over from MediaTemple to Dreamhost. I was messing with DNS settings and MX records and SSHing into both servers and running SQL queries to back up and restore this blog’s database, since it was too big to handle by the WordPress export/import system. I amazed myself with what I accomplished and learned in that whole process, and wanted to dive into it more.

So at some point a few weeks ago, I pulled up an old box I had rusting in the basement and tried to boot it up. Apparently it had rusted a bit too long and either the CPU or something on the board was fried. I went onto Amazon and bought a motherboard and cpu, along with some RAM, a 2 TB hard drive, and a DVD player/recorder. I had a bunch of unused gift certificate money on account, so it technically didn’t cost me a dime, but came to about $300 something total. The components trickled in and I sadly realized that I was the owner of a micro ATX case, and a full ATX motherboard. So back to Amazon for a nice case.

The case arrived and I realized that my power supply had only the IDE type connectors, no SATA connectors, which I needed for my drives. I picked up a new power supply locally and I was in business. Since then, I added a new fan, a fan control unit, and a memory card reader. Here’s the building in progress:

The empty case with power supply:
IMG_0687

The motherboard installed:
IMG_0688

And the CPU and fan:
IMG_0689

All the front panel stuff wired up:
IMG_0690

Everything in place:
IMG_0702

Wide shot:
IMG_0703

Cover on:
IMG_0701

And a front view:
IMG_0699

I had a real blast building this, shopping around for parts, learning about different boards and chips, formats and standards. Stuff that I’d forgotten a lot about. For those who are interested, the specs are:

MB: Intel Media Series ATX Motherboard BOXDH55HC
CPU: Intel Core i3 Processor i3-540 3.06GHz 4MB LGA1156 CPU BX80616I3540
RAM: Corsair 4GB Dual Channel Corsair DDR3 Memory for Intel Core i5 Processors (CMX4GX3M2A1600C9)
HD: Western Digital 2 TB Caviar Green SATA Intellipower 64 MB Cache Bulk/OEM Desktop Hard Drive WD20EARS
Case: Cooler Master RC-310-BWN1-GP Elite 310 ATX, MATX Mid Tower Case with Window (Black/Blue)
Fan Controller: Scythe “KAZE MASTER ACE ” 5.25″ Bay Fan Controller- Black (KM02-BK)

Not a top of the line system, but decent enough, with lots of room to grow.

Software

Now that I had a box up and running, time to install some stuff. I went with Ubuntu 10.10. Installed VirtualBox and pulled out my old Windows install disks and set that up with Windows 2000, Windows XP, and Windows 7. The first two, mostly just because I could, and because I have 2TB of disk space to play with. Actually 3TB, because I salvaged another 1TB drive out of another device I wasn’t using.

I opened up ports for VNC, SSH, and HTTP, and set it up with www.dyndns.com so now I can access the machine from anywhere and do just about anything with it. Really having a blast exploring all the options.

Back to Ubuntu

All right, this is what I started to write about in the first place. I really enjoyed using Ubuntu on my server. I sat up in the living room SSHed or VNCed into the server, exploring stuff, installing new programs, finding out what I could do. It was great, but VNC is VNC. I set up VirtualBox on my PC and ran it from there as well. After a couple of weeks of doing both, I decided to make the jump to a full dual boot Ubuntu system. That’s what I did over this past weekend. It went very smoothly. I now had a dual boot system that defaults to Ubuntu, but also has Windows 7 as an option.

My next goal was to see if I could use Ubuntu full time as my main OS. For playing around, it was just fine, but if I was going to use it day in and day out, I needed to have a bunch of stable, viable, usable applications for doing all my day-to-day stuff. What amazed me was just how many of the apps I use on a regular basis have Linux versions. I don’t mean similar apps that do the same basic thing, but actual Linux versions of the exact same programs.

For example, I use Launchy as a task launcher, RapidSVN as an SVN UI, Tweetdeck for twitter, KeepassX for passwords, Skype for … Skype. all of these have Linux versions that I was able to install right off the bat. Made me feel quite at home and comfortable.

I’ve been making heavy use of Google Apps, having switched over my BIT-101.com email to Google apps. So mail, calendar, RSS, and documents were a no brainer and completely seamless. Chrome works fine on Ubuntu, too. With all that down, I felt I was almost able to make the switch. The big thing was going to be Flash/Flex/AIR development.

Obviously, CS5 does not exist on Linux yet. Nor does Flash Builder. But the Flex SDK and MXMLC works just fine there. You just need something to write your code in. There were two main choices – FDT and IntelliJ Idea. Both of which I happened to have licenses for. While IntelliJ is pretty awesome, it’s so different from Flash Builder, which I am used to, that I found it hard to really get comfortable with. FDT is Eclipse-based, like Flash Builder. The devil you know… as the old saying starts. So I decided to go with FDT.

Getting it set up was fairly easy, and I was hello worlding before I knew it. But the project I’m in the middle of presented a much bigger challenge – not a straight AS3 web project, but a Flex based, full screen AIR application that will be deployed on a kiosk. If I could get this going with FDT on Linux, I was home free. Some serious problems lay ahead. One was that I needed a debug player for 64 bit Linux. I dug one of those up somewhere – maybe labs? Then I was having problems with my embeds. Something is handled different on Windows and Linux with paths. I finally figured out I just needed to add a “../” in front of the embedded asset path. Not sure why it’s different. But that path works in both Windows and Linux, so it’s probably the “right” way. Next up was run/debug configurations. In FDT, if you are editing any class and you do a run or debug, it will create a run/debug configuration with that class as the main application. This is very different than Flash Builder, where you set the main application class and it will always use that. I finally worked through a couple of tutorials on the FDT site that straightened me out. Basically, you need to create your own configuration, and then, in preferences set Eclipse to always use the last configuration if one is unspecified. Handled.

The final problem was with AIR. All kinds of weird errors going on there. But no AIR file launching. After much searching, I finally realized that AIR SDK that you get when you download a Flex SDK is only good for Mac and PC. You have to go here and download the AIR SDK for Linux. I’m not sure how you are supposed to integrate the two of these things, but what I did was to go into the bin folder of my flex sdk folder, and remove adl, adl.exe, adt, and adt.bat, and replace them with the adl and adt files from the linux sdk. This is probably a very half-assed solution, but it actually worked. If anyone has any more robust directions, let me know, but with all of the above, I am now compiling and debugging my app without a hitch. I’ve also got MinimalComps compiling its swc using FDT, and the next release will be produced that way.

As for the time line on all this, I started trying to compile the app on Monday morning, but ran into all the problems mentioned above, so had to retreat back to Windows so I could get some work done for the day. I went home Monday night and worked through all the solutions I just mentioned. Tuesday I went to work and booted up Linux and haven’t looked back. That’s two full, very productive work days on Ubuntu alone, building a Flex based AIR app. I’d call that a success. I’ll definitely be finishing out the week on Ubuntu and heading into the sunset with it. 🙂

A bunch of people on twitter asked me about Flash, Photoshop, and the Creative Suite in general. The answer is that I don’t use Flash CS5 all that much. Well, actually I do use it fairly often, but not for long periods. I’ll fire it up to test out some snippet of code or spike out some idea. it’s great for that. But once the idea moves into something serious, it always gets moved into a more serious development environment. I will kind of miss that. Currently I’m looking into wonderfl.net to fill that gap. I’m not saying this is a solution for everyone. If you do a lot of timeline or library stuff, you really need Flash. For me, I just need a way to fire up something and lay down some fast code and see what it does without creating a workspace, package, classes, etc. wonderfl may serve that purpose in many cases.

As for graphics stuff, I haven’t run into a need for that yet in the last few days. Fireworks has been my weapon of choice for several years. I’m not sure what my solution will be for that yet. Naturally, when you think “Linux” and “graphics”, you think “Gimp”. It’s been years since I touched that, but I imagine when the need arises, I’ll look at it again, and then look around to see what else is out there too.

There’s also the possibility of running Windows on VirtualBox and installing CS5 in there. I think VirtualBox is great for some stuff, but large, resource heavy programs like Flash and Photoshop… the idea of those running in a VM scares me. I’ve tried running Visual Studio 2010 for Windows Phone stuff there, and it’s pretty slow. Also the Windows Phone emulator refuses to work in VirtualBox. An emulator in a virtual machine… go figure. Then there’s Wine, which may be able to run Some CS programs. I can’t speak for how successful that might be. My bottom line thought is that if you are REALLY dependent on Creative Suite programs and use them heavily day to day, Ubuntu is not the OS for you. You’re just setting yourself up for frustration.

On the PC I’ve been using Putty for SSH and TightVNC for VNC. Ubuntu has SSH and VNC capabilities built in, so that was easy. For IM, I’m using the built in Empathy client, which seems to handle my multitude of IM accounts perfectly well. Finally, you can’t work without some sounds of one kind of another emerging from your computer and into your ear holes. I go back and forth between podcasts and music. Ubuntu has RhythmBox preinstalled. It’s OK, but I’ve been checking out others. I’m pretty happy with Banshee at the moment, but will probably keep exploring.

After just two days, I’m already looking at editing my partitions to give Ubuntu some more room, and moving more of my files over to the Linux side. I need to keep the dual boot setup at least for my Windows Phone development, as I have one project half done, and will probably do some more stuff with that. And it’s just not happening virtually.

At any rate, as I also mentioned on twitter, if you are a professional developer, you really need to have access to a Windows box and a Mac, one way or the other, virtual or physical. I think any professional developer who bitches about this or that operating system or platform or language or device and sticks to one single platform, refusing to touch anything else is childish and unprofessional. At the very least, it’s a pretty poor long term career attitude. Learn more. Experiment. Try something new. You’ll be a better person for it. It’s fine to be an expert in a specific area, but don’t paint yourself into a coffin. (you like that one?) In addition to my home server and my dual boot laptop, I have a Mac book at home and a Mac book pro at work, both plugged in and ready to go. I have three fully charged phones within arms reach – my iPhone, Nexus One, and Samsung Focus (WP7). I don’t like to get too comfortable with any one thing. I feel like I’m stagnating. I used my Windows Phone for the last 3 months. Now i’m carrying the iPhone again, just for a change. What makes you more valuable – the fact that you can make a good snide remark about how much platform X sucks as compared to the platform you use? Or the fact that you can sit down and be comfortable and productive in any platform? Which makes you feel more confident?

Sorry. Got a little preachy there. Just get tired of hearing about technology wars when there is so much awesome and exciting stuff to learn and play with. Now more than ever. End of rant. Try Ubuntu. You might like it.

38 responses so far

More MinimalComps updates

Jan 27 2011 Published by under ActionScript, Components, Flash

A couple of things today.

First is on adding content to Windows and Panels. By default, if you added a child to one of these, it would just add it like any other child, positioning it from the top left of the parent’s position. In particular on the Window, this forced you to reposition your content so it wasn’t on top of the title bar. Also, in either case, if your content was larger than the parent, it would march on outside of the bounds of the parent.

To handle this, I created a content property on these components, which was positioned correctly, and masked the children added to it, so it looked correct. The recommended way of adding children to Panels or Windows was thus:

window.content.addChild(btn);
panel.content.addChild(myRadioBtn);
// etc.

or…

new PushButton(mywindow.content, 10, 10, "click me");
new RadioButton(mypanel.content, 10, 10, "option 1");
// etc.

Unfortunately, this just wasn’t very obvious, and in retrospect, pretty stupid. The proper way would be to override addChild to add the child to the content automatically. So, that’s what I did. I also added a new addRawChild method to each of these components, in case you are doing some custom hackery that really required adding children to the component itself. The following should illustrate the change:

If you were already using content, you won’t see any changes, but you don’t need to use it any more. If you were adding children with addChild and repositioning manually, you’ll probably need to adjust your code to remove those manual adjustments, again, particularly on the Window.

This change also applies to Accordion and Scrollpane, which are based on Panels and Windows.

I also adjusted MinimalConfigurator to account for this, which mainly means I was able to remove the code that checked if the parent had a content property. Now it can always just addChild.

The next change was something else that’s been bugging me for a long time – the PushButton down state. It added an inner drop shadow, but otherwise was not very visible, particularly when using toggle = true. It wasn’t very obvious when a button was toggled in the down state.

So I added a new property on the Style class: Style.BUTTON_DOWN, which is used to redraw the button face when it is down, making it slightly different and much more noticeable. I added values for this to the light and dark themes. If you’ve created custom themes, you can add this to it.

SVN has been updated, and a new SWC and zipped source package have been uploaded to Google Code.

ps. If you used MinimalComps and want to join the conversation, check out the new Google group.

2 responses so far

MinimalComps Google Group

Jan 22 2011 Published by under ActionScript, Components, Flash

As suggested by Vic C, I’ve set up a Google Group for MinimalComps. Discuss, request, share.

http://groups.google.com/group/minimalcomps

One response so far

MinimalConfigurator.getCompById

Jan 22 2011 Published by under ActionScript, Components, Flash

Just added a new feature, as suggested by Karim in the previous post. This saves a hash of all components that have id attributes, and then allows you to find any component by its id. Here’s an example:

package
{
	import com.bit101.components.*;
	import com.bit101.utils.MinimalConfigurator;
	
	import flash.display.Sprite;
	import flash.events.Event;
	
	public class Playground extends Sprite
	{
		private var config:MinimalConfigurator;
		
		public function Playground()
		{
			Component.initStage(stage);

			var xml:XML = <comps>
							<PushButton id="foo" label="hello" event="click:onClick" x="10" y="10"/>
						  </comps>;
			
			config = new MinimalConfigurator(this);
			config.parseXML(xml);
		}		
		
		public function onClick(event:Event):void
		{
			var btn:PushButton = config.getCompById("foo") as PushButton;
			btn.label = "goodbye";
			trace(btn.name); // foo
		}
	}
}

Also, it maps the id to the component’s native name property, in case that might be useful.

All in all, this allows you to access multiple components without having to make a bunch of public variables.

4 responses so far

MinimalComps Updates: Dark Style, HBox & VBox alignment

Jan 20 2011 Published by under ActionScript, Components, Flash

A couple of updates to MinimalComps.

First, go over to soulwire and check out the great GUI tool created there. One thing that struck me about it was the dark colors on the components. I liked it and set out to create a similar theme by setting dark values on the Style class. Easy enough. But I didn’t want to go through that every time I wanted to create the same look, so I added a new method on Style, called Style.setStyle. This can be “light” or “dark” (Style.LIGHT or Style.DARK). If you don’t set it, or set it to light, you’ll get something like this:

But with one line:

Style.setStyle(Style.DARK);

you can instead have this:

I like it a lot. If you haven’t used the Style class before, It’s just a list of static vars containing colors that are used whenever a component draws itself. Setting a value on Style does NOT update anything that’s already created, until that component re-draws itself, if it ever does. You should set your style values BEFORE you create a single component, and not change them, unless your’e going to take responsibility for redrawing anything. Same goes for this new method. If anyone comes up with any other useful preset styles that look decent, send them over and if I like them, I may add them to Style. And you’ll win a free set of Minimal Components!

The other change I made is to the HBox and VBox. These have really been bugging me because HBoxes always top-align their contents, and VBoxes always left-align their contents. You can set the x position of an element in a VBox and the y position of an element in a HBox, but it was tricky and non-dynamic. Now they each have an alignment property. This can be top, middle, bottom, or none for HBox and left, center, right, or none for VBox. These are static constants on the respective classes as well (HBox.TOP, HBox.MIDDLE, etc.).

The default alignment for both is NONE, meaning that they’ll work the way they always have. Left and top aligned, unless you’ve set the x or y property of an element as just described. If you set the alignment to anything else, it will ignore the current x or y property and align them exactly as you would expect. Here’s a demo:

Get Adobe Flash player

All these changes are checked into SVN. I have one other thing that I’m working on before I go and release a new SWC though.

10 responses so far

SWFSheet Version 1.1 beta

Jan 12 2011 Published by under Flash, General

It snowed here in Boston on Wednesday. Enough that I didn’t make it out of the house. Or at least not out of the driveway with shovel in hand. So, with a day off, I worked on adding features to SWFSheet. From yesterday’s post, I successfully implemented features 1-3. To recap and expand:

1. PNG Sequence Export. Click on the new button “Export PNG Sequence” and a small window will pop up. Here you can enter the prefix to save the files with (“frame_” by default), and browse to a directory to store them.

2. Custom Sprite Sheet Sizes. There’s a new radio button in the size section, called “Custom”. There’s also a button there that will pop up another small window allowing you to set the size of the custom sprite sheet size, up to 4096×4096. Nuff said.

3. MetaData Saving. Click the Save MetaData button and yet another small window will open. This has a group of radio buttons allowing you to choose an export format. The first is the Zwoptex xml/plist format used by cocos2d. Then the Corona format, which should save in a format defined here. There’s a generic XML format I created, and the Sparrow format, which is essentially the same with slightly different names, and a raw text format that is just a comma-delimited, one-frame-per-line text dump of x,y,w,h.

As I write this, a few people are testing the new build, and so far so good. But I’m releasing this as a beta, just as a warning that the new stuff may not be thoroughly tested – particularly the export formats. In fact, they might not be tested at all. So try them out and let me know if you run into any issues and I’ll correct them ASAP.

As for more advanced texture packing, I’ve pretty much decided against doing anything on this. I’ve had a couple of offers to share code or collaborate on packing algorithms, but I think I’m going to decline. For one, there are already some great tools out there that do a good job of this. Zwoptex as I’ve mentioned, and also TexturePacker. It would take a LOT of work on my part to come close to what they do in that regard. They also do stuff like PVR generation, and multiple bitmap formats, dithering, transparency masking, etc. So I’m not going to bother trying to compete with these products, but do something that works well with them.

The other point is that with the new PNG Sequence Export feature, SWFSheet will work in conjunction with these or any other tools wonderfully. Load your sprite, set the frame, number of frames, etc. and export a PNG sequence. Load that into one of these other tools and pack away. This doesn’t belittle the value of SWFSheet at all. Those other tools cannot make sprite sheets from SWFs. And there’s no good way to get image sequences out of Flash, so they complement each other perfectly.

You might be saying to yourself, “but Flash already has an image sequence exporter.” But if you’re saying that, you’ve never actually tried to use it. It’s virtually useless. Yes, it will export a sequence of the frames on the main timeline. But what if you have animations in nested clips? Nope. Animations set up with code on enterFrame events? Nah. Timer-based animation? Tween libraries? Forget about it! SWFSheet will export PNG sequences from all those without a problem. In fact, the more I thought about it, the more I realized that the PNG Sequence Export is really a pretty awesome feature all by itself.

So here for your pleasure, is SWFSheet 1.1 beta. Use it, abuse it, give me feedback.

74 responses so far

SWFSheet coming features

Jan 12 2011 Published by under Flash, General

[EDIT: Just released a beta of SWFSheet 1.1 here: http://www.bit-101.com/blog/?p=2948]

The response to SWFSheet has been overwhelming. I guess I wasn’t the only one who found such a tool useful. I’m going to release a new version with some updates soon. Here’s what I’m looking at adding:

1. PNG Sequence Output. Instead of a single sprite sheet, output a series of PNG images into a directory of your choosing. You can then use these directly or use them with a more advanced sprite sheet tool to make a sprite sheet. This feature is actually complete already.

2. Custom Sprite Sheet Sizes. You really want to use power of two squares for your sprite sheets. Trust me. But I’ll give you enough rope to hang yourself and let you make custom sizes.

3. Metadata Saving. This will allow you to output a file telling you where all the frames are. What I need from you is to tell me what formats you want this in. The one I know of offhand is the one used by cocos2d and Zwoptex, which is a plist / xml file. I’ve also talked to Grant Skinner about outputting the JSON format used in EaselJS. Once I have the output functionality written, it’s pretty easy to create different formats. So let me know what other formats are out there that you’d like to see supported.

4. Multi-Sized Frames, aka “sprite packing”. In the current version, you create a single frame size, and this is used for every single frame, resulting in a uniform grid. Other sprite sheet tools allow you to create each frame with exactly the size it needs, and pack them together to maximize the amount of space and potentially use a smaller sized sprite sheet.

Numbers 1-3 are definitely on the road map. I can’t promise number 4. It can get pretty complex to do effective packing, and the cost / benefit equation is questionable. Anyway, with the PNG Sequence Output feature, you can make use of other tools that already do this better than I might.

Any other features you might want? Let me know.

Two other things.

1. No, I’m not planning to open source SWFSheet.
2. SWFSheet will remain free, but if you find it useful, feel free to donate to the cause with the donate button at the bottom of the post.

4 responses so far

SWFSheet – create sprite sheets from SWFs

[EDIT: Just released a beta of SWFSheet 1.1 here: http://www.bit-101.com/blog/?p=2948]
[EDIT: Version 1.1 final released: http://www.bit-101.com/blog/?p=2977]

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

Enjoy!

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

Older posts »