I've been playing with Flex (as you may have heard) and I thought to myself 'why not jump in at the deep end and build something that works with Flash Media Server'. What I came up with (and what is work in progress) is this Flex audio chat app. Basically a text chat application which also support push to talk functionality - no video right now, just audio and text.

I've learnt a lot from building this, most notably:

  • There is now a client property for objects such as NetConnection and SharedObject, you need this to tell Flex where to direct callback methods to (so there's no more nc.doThis() - oh no). Thanks Owen
  • To make individual properties in an AS3 class bindable use custom events for each property. Something like
    [Bindable (ChangeEvent='histChange')]
    public var chatHistory:String = ""
    Thanks Johannes, you are the official Bindings-meister (no, not bondage!), who btw hasn't blogged since October 4th ;-)
  • If you are using a custom MXML itemRenderer (I did for my userlist) and want to inject some conditional logic into it, override data's getter/setter (I did in usersRenderer.mxml but couldn't have doen it without Tink, the IM oracle and Community Experts Expert).
  • FIXED In order to get a TextArea component to scroll all the way to the bottom programmatically you need to some weird sh*t. One would have thought that verticalScrollPosition = textField.maxScrollV may do the trick but no - this.validateNow(); is needed also.
    BUT STILL: while the last line of text is now visible, the scrollbar won't go right down (see pic). What's going on there? Any ideas? (NOTE: this has now been fixed, check comments for details). Thanks to mr for the validateNow() guidance.


    So there you go, Flex with live audio, and no I have no idea how well it scales. BTW I am sharing the sources for the text version only - no audio right now as this may turn into a commercial project - sorry. But I do hope you learn a lot from my code and my mistakes, and the audio part should be fairly easy to add.

    Check out FlexAudioChat