My take on sequencing Cairngorm events

I`m working with Cairngorm in nearly all of my projects and I like it because it somehow forces me to work structured. But there are some things that I don`t like or don`t get. For example sequencing of Commands in Cairngorm is done by subclassing SequenceEvent and putting all the logic for which event comes next directly into the Command itself. By doing so the command looses a lot of reusability. What if I want to use the same command outside of a sequence chain?
I would have to code two commands – one for the sequence and one that lives on it`s own. The other thing is that when i fire a cairngorm event from my view i have no way to know when the corresponding command is done. Only way would be through some sort of state variables in my model that keep track of the process. I believe that this approach is quite fragile because sometimes you might have to commands of the same instance running and you`ll never know which of same changed your model. And a model with hundreds of state variables just doesn`t look clean to me.
I lived with all these problems for some time know and never really thought about forking the original cairngorm framework because I like to work with the original framework to be safe for future changes.
But now I just can`t live with these problems anymore – so here is my first try into improving this stuff.
Continue reading

Adobe Premiere in AIR…

… not really πŸ˜‰ but it`s impressive how far one can get in a few hours.
In this new version it`s now possible to edit multiple flv files and multiple mp3 files and combine them to one flv.
The binary stuff works pretty well but my main problem is the internal preview. It`s really difficult (impossible???) to play flvs and audio files and synchronize them.
Any suggestions?
So the solution for now is that everytime one clip is cut or the audio changes i create a new flv file in memory with all the changes applied and load that back into the preview.
Sure this takes some seconds and gets harder the bigger the files are but still it`s not that bad and you`ll get 100% accuracy.

Check out my screencast of the current progress here

richflvNextGen2.jpg

Next Generation RichFLV preview

I`m currently loaded with exciting work so i rarely feel the need to work on my private projects like RichFLV. But today was one of those days.
While making RichFLV more stable i started working on a completely new version. One of the needed features is support for editing multiple flv files.
I want to be able to import some flv files and stitch them together and even edit and cut the individual clips and later export them to one single flv file.

Well it`s working! Have a look at this feature in this very early preview screencast I made. Don`t worry this is not how RichFLV will look like it`s just a dummy to test the functionality πŸ˜‰
I think it`s really crazy that you can do stuff like this with AIR – it just rocks!

A basic implementation will be added to the current RichFLV next week (or so :-)). You`ll be able to import another flv and stitch them together but without the advanced control of individual clips.

Watch the screencast here

this is how the new timeline looks:

newTimeline.jpg

RichFLV for AIR Beta 3 released

I made a quick update to RichFLV. It should now work with Beta 3 of AIR.
Haven`t really had the time to make lot of bugfixes so let me know if you need something fixed.

[kml_flashembed movie=”http://www.richapps.de/files/richflv/installbage/badge.swf” height=”180″ width=”217″ fvars=”appname=RichFLV&appurl=http://www.richapps.de/files/richflv/installbadge/richflv.air&airversion=1.0.M6&buttoncolor=FF0000&messagecolor=000000&imageurl=http://www.richapps.de/files/richflv/installbadge/richflv.jpg” /]

You`ll need Flash Player 9 Update 3 for the seanless install to work. If you don`t have it yet you can download the air file manually here.

Flex/AIR rocking Javapolis

I have been relatively quite the last weeks mainly because my current project was to be kept secret until today.
Today I presented together with my current client Stephan Janssen the result of 5 months Flex and AIR development.
Boy when do you get the chance to present you work in front of 3000! Java developers πŸ˜‰

It was really amazing and the feedback is really overwhelming. We presented at the Keynote right after the Adobe team (Bruce Eckel, James Ward, Christoff Rooms).
I think most of the Java people liked it and are now seriously looking at Flex and AIR.

So some notes about the actual project we presented. It is version 2 of Parleys a website dedicated to present presentations from various Java conferences.
The current client (version 1) was build with Java Script and is now rebuild with Flex and AIR. The actual application will be available as soon as AIR gets out of Beta so beginning 08.
Continue reading

Resumable Downloads with AIR

I`m just developing an AIR project were the client needs to be able to synchronize big loads of data. So I thought it would be cool if the user can pause and resume downloads.
I first thought that this would not be possible but then i looked at the Adobe Media Player and he does it as well (Look into the Download Manager). The trick seems to be easy.
After a quick search through the Http specification i found out that you can write a custom header to use with the URLStream class. With Http specification 1.1 you can define a range of bytes you want to download so you don`t have to start from the beginning.
Here is how a sample Request looks like:
GET /files/richflv/help/ExportOptions.flv HTTP/1.1
Referer: app-resource:/LoadingTest.swf
x-flash-version: 9,0,60,153
Range: bytes=1200000-1300000
User-Agent: Mozilla/5.0 (Windows; U; en) AppleWebKit/420+ (KHTML, like Gecko) AdobeAIR/1.0
Host: www.richapps.de
In Actionscript we can write a custom header like this:
var header1:URLRequestHeader = new URLRequestHeader(“range”,”bytes=”+currentBytesPosition+”-“+toRange);
var re:URLRequest = new URLRequest(downLoadURL);
re.requestHeaders.push(header1);
currentBytesPosition = toRange;
urlStream.load(re);

This should work with most servers/files. To make sure it works you can first make a request and analyse the response header. It should include something like this:
Accept-Ranges: bytes

I think you get the idea! This is pretty powerfull especially if you want to synchronize big chunks of binary data and the client closes the client in between.
On the next startup you can simply resumeΒ  the download at the position were the client closed your AIR app. There are so many hidden goodies in AIR/AS3.0!

RichWav Sneek Peak

During the nights of MAX Europe i worked a bit on my wav mixer tool (now oficially called RichWav ;-)) and made some nice improvements.
You can now create multiple tracks and have a library of wav files that you just drag to a track. Every track can have multiple samples.
If you press play every track gets converted internally to a wav wich is embedded in an swf and returned to the Loader. This works pretty fast even for a lot of tracks.
The best thing for sure is that you can save the whole thing down to one wav on your harddisk. Just wanted to give an update to what i`m doing in my free time right
now as an excuse for not updating RichFLV to Beta 2.Β  I did it already but need some tweaking – if one needs a Beta2 update of RichFLV very urgent let me know and i send you what i have so far :-)
richwav.jpg

MAX Europe Presentation files online

Finally here are my slides from my session about “Bits And Bytes With AIR”. You can get the Flex sample project here.
It shows you how to analyze an flv file and extract the sound data as an mp3 file.
The whole presentation itself is done in AIR. It might be a bit difficult to navigate.
You the cursor keys to go back and forward. Sometimes you can trigger animations or different states within one screen. You can do this with the Up and Down keys.
I know it`s not very userfriendly but i thought it would be cool to give a presentation about AIR in AIR πŸ˜‰
The original reason i did it in AIR was that i was sick of my boring powerpoint presentations. I was really envious about all the people that could use keynote on their Macs.
So i build this little presentation tool with Flex and AIR with some funky transitions done with Papervision 3D. You can change the transition type with these keys:

– R = Replace

– B = Box

– S = Switch

– I = Inside Box

– N = None

Use those keys to change the transition types and then the cursor keys to actually switch the slides.
Below are some screens from the transitions. Is there still anyone thinking Flex is not as expressive as Flash? πŸ˜‰
slide1.jpg

slide3.jpg

slide2.jpg

slide4.jpg