Archive for the How to category

Ant, Apparat and FlashDevelop: a total beginner’s guide

Posted by Kerry Turner on March 8, 2011

Before we start, a quick heads up: I’m new to both Ant and Apparat. If you know a better way of doing anything that I talk about here, please let me know! I should probably also clarify that this guide is for Windows users only, and that these steps apply only to projects that are compiled using the Flex SDK rather than the Flash IDE.

So, I was using FlashDevelop to compile my AS3 project, and then running the published swf through Apparat’s Reducer to reduce its file size. I wanted to automate that process so that compiling and reducing could be done as one action. Turns out you can do it all from within FlashDevelop. Let me show you how.

This guide is in two parts. The first is a guide to downloading and installing Apparat itself. If you’ve already got Apparat working, skip straight to part two where I explain how to get started with Ant and how to set up an Ant task to compile a swf and then run Reducer on it.

Read the rest of this entry

4 comments

My Flixel talk: demo, source code and a couple of other bits

Posted by Kerry Turner on July 7, 2010

I can only apologise for this.Thanks to everyone who attended or watched the stream of my Flixel talk last night. I think it went pretty well, although I’ve been kicking myself all day about the cool things I meant to mention but completely forgot. You guys, FlxG.debug! Etc.

For anyone who didn’t make it but is desperate to watch me make an arse of very basic physics, I think the video should be up soon. I’ll let you know when it is, of course.

As promised, here’s the source code for the AMAZING example game I made in the second half of the session. I should explain that the purpose of this example wasn’t to wow anyone with my coding prowess – rather to show how quick it is to get a very basic game up and running using Flixel, and to demonstrate some of the really handy helper methods like createGraphic().

Play Flixel demo (God knows why you’d want to, though)
Download source code (ActionScript 3 and Flixel)

Here also is my a quick description of the config I’m using, as a few people seem to have trouble getting Flixel set up – but please note, this is Windows only. I’ve got FlashDevelop 3.2.1 (get it here), Flex SDK 3.5 (get it here), Flash 10.1 debug standalone player (get it here). I’m currently using Flixel 2.23 but I’m about to upgrade to 2.35 once I’ve finished my next project – I’d recommend going with the most stable recent version (get it here).

Finally, here’s a link to the site where I found the royalty-free music for the demo: http://www.pacdv.com/sounds/. You’re welcome.

Oh, and post-finally – here are a couple of links some great resources for help with Flixel: the Flixel documentation, the Flixel forums and the incredible Flixel section of the Flash Games Dojo. These’ll sort you out, no problem.

Now start making games!

2 comments

CHKDSK, Windows 7 and Subversion: they don’t play nice.

Posted by Kerry Turner on May 5, 2010

Just in case anyone else is tearing their hair out with this one: if CHKDSK is running very frequently on your Windows 7 machine and you’re a Subversion user, that’s your problem right there. I was getting CHKDSK on every other reboot, and it took a lot of searching to get to the bottom of this – it seems CHKDSK is kind of trigger happy on Windows 7, so there are a lot of posts out there about all sorts of other possible causes.

Long story short, you should either stop using Subversion (nooooo!) or turn off Windows Search indexing until a patch comes out. I tried the latter and it works perfectly.

Thanks to all the lovely people on this very helpful thread.

No comments

Embedding Flash content in WordPress posts and RSS feeds

Posted by Kerry Turner on September 30, 2009

Another day, another WordPress learning curve. This time, it’s to do with embedding Flash content in your posts and feeds.

What I wanted to do: embed Flash content in my posts in a way that’s XHTML compliant and also works for feeds.

I started with swfobject, the awesome JavaScript library that is standards-compliant, degrades gracefully, offers all the paramaters you could possibly want and cooks your dinner for you (one of these may not be true). Unfortunately, writing the swfobject code directly into my posts didn’t meet one of my requirements: while it worked fine on the site, it did nothing for my RSS feeds.

WP-SWFObject is a plugin that looked promising: it cleverly uses swfobject code when content is viewed on your site but replaces that with <object> and <embed> code when in your feed. I had some initial problems with WordPress adding unwanted paragraph tags to the [SWF][/SWF] code I added to my posts, but I fixed this by putting it on its own line with a containing div around it. So far, so good: XHTML compliant site and a feed full of Flash goodness.

Except, it turns out, it just doesn’t work like that. All feed readers, aggregators and parsers seem to handle Flash in RSS feeds wildly differently. Google Reader, for example, works on a whitelist basis: at present, it’ll show embedded content from Youtube and a few others, but good luck getting your homemade swfs to show up. Feed subscribers might see your swf, a blank space or an error message depending on their setup – not really a gamble I wanted to take.

After all that, I decided that the best way to ensure a consistent experience for feed subscribers would be to point them back to the site whenever there was Flash content involved. Sigh. So, long story short: optimise for your site in whatever way works best for you, and don’t worry about feeds for now. You’re welcome, etc.

No comments

WordPress, Twitter, RSS and Dreamhost: sigh.

Posted by Kerry Turner on July 27, 2009

I had a nightmare earlier this week trying to show my latest tweets in this WordPress blog. I googled a lot (A LOT) to find some decent information on this without success, so I’m posting this in the hope that it clears things up for anyone else who’s having this problem.

I couldn’t connect to Twitter from my site at all. When I tried using Twitter Tools, I got massive slowdowns and the following scary error message:

Warning: fsockopen() [function.fsockopen]: unable to connect to twitter.com:80 (Connection timed out) in [myURL]/wp-includes/class-snoopy.php on line 1142.

All I wanted to do was grab the RSS feed of my public tweets, so I wasn’t worried about using Twitter Tools specifically. However, no matter how many ways I tried to connect to Twitter – using cURL, or just trying to grab the feed like I would any other RSS feed and parse it with SimplePie – I couldn’t get it to display at all. All I was getting were timeouts or reports that there were no public messages in my feed.

I contacted my host, Dreamhost, and they confirmed what I suspected: the problem is on Twitter’s end. For some reason, Twitter seems to be blocking my IP. I contacted Twitter about this, but am still waiting to hear back (update: September now, still waiting!).

So, long story short, if you’re getting this sort of error repeatedly: chances are that Twitter is blocking your site and you simply can’t connect to it, full stop. It’s probably not the news you were hoping for, but hopefully this little gem will save you hours of trying to fix something that is nothing to do with your code!

I’m still hoping this’ll be resolved eventually, but in the meantime the only way I’ve found to integrate Twitter into my site is to use a middleman: stick your Twitter feed in an aggregator, use a widget hosted on a different site, etc. Not ideal, but does the trick.

3 comments