Socket.IO is a great socket communication library that I’ve used many times in recent years. To connect to the server from a flash client I’ve had to rely on a library I found on github called FlashSocket.IO, actually on improved fork of an earlie, now stagnant project.
Socket.IO has recently made it to a 1.0 release, which is long overdue seeing as many people have been using it in production for ages. However this is not a ‘finally stable’ 1.0 release. This is more like a 2.0 release with a complete rewrite of the underlying engine and many API and protocol changes. If you were only using it via the official js client and not trying to inspect the internals at all then you can probably just update without a hitch.
However for my flash client this meant trouble. So, I’ve gone through and updated the flash client to work with 1.0, and added a few other features too, such as ssl compatibility (essential for working reliably with public networks), querystring parameter support (for passing arbitrary parameters from the client to the server to be available at connection time) and making the FlashSocket EventDispatcher robotlegs friendly.
It’s up here, so if you need 1.0 compatibility from flash have a go, and let me know if you have any problems.
Often I find, particularly with exhibit type projects, there is a requirement for some looping video. Often the loop is required as it’s part of the UI, rather than consumable content. A designer or animator has made some cool effect and video is simply the best way to deliver this asset.
Now there comes a problem – in older versions of flash player it was quite easy to just loop a video, but in more recent releases it’s broken and according to adobe this is not important enough to fix.
The only way that I found to get around this was to convert the file to a swf with the video on the timeline. I had some success with this, but the quality always suffered and every time the designers updated the asset I had to reconvert. Someone on the bug report suggested however that there might be way to get the video file to repeat seamlessly by using appendBytes but hadn’t provided a working example. So I just ran into this again and decided to tackle it once and for all – here’s a class that’ll seamlessly loop an flv (appendBytes only supports flv):
Edit: I recently had cause to use this again in a project so have tidied up the code a little and fixed a bug where I had delays in later loops. Also I’ve added a variation for cases where an animation plays in with one video, then loops with another.
So I’ve been struggling all afternoon to get TLFTextfield to display direction = Direction.RTL without any success. The rtl text still flowed left to right. I just got it to work with the help of this post
Basically it’s just this bit:
var myFormat:TextLayoutFormat = new TextLayoutFormat();
var myTextFlow:TextFlow=tf.textFlow;
myTextFlow.hostFormat=myFormat;
…needs to go at the end and it all starts working. urgh.
For my own benefit, just a note – http response headers are only readable from AIR via HTTPStatusEvent.HTTP_RESPONSE_STATUS, but not from Flash Player. This library does the magic: https://github.com/gabriel/as3httpclient and can give you the headers. I even tweaked it to provide headers for an ICY mp3 stream so I can see where the metadata lies.
This may be well known, but it wasn’t terribly obvious to me from Adobe’s documentation.
If you want to use the adobe AIR update framework including the UI in a pure AS3 AIR project, it looks like you need to start using the flex framework.Indeed, the documentation for “flash apps” recommends custom building an interface.
This is unnecessary – I picked out the applicationupdater_ui.swc from flex_sdk\frameworks\libs\air and accessed the ApplicationUpdaterUI class just as the documentation advised for a flex implementation and Lo – it’s all there, and it doesn’t include the whole of flex. It does add a few hundred kb, but it’s an installable AIR app, so that’s not such a big deal.