That presentation is almost the same as the one I actually went with in the session (minus a few unimportant last minute edits). The hard part about doing a session that jumps between the slides and code in Eclipse is I don’t have any of the code we went over in the presentation. So here are a few of the examples that I covered, with source code.
Resizable Wrapper component
Demo | Source Code
This is a container component that adds resize handles and a drag bar that allows you to resize it’s contents and drag it around. Pretty straightforward, not too exciting. You would use the component like any other container and wrap it around the object you wanted to resize. So something like:
Adding resize handles to every UIComponent
Demo | Source Code
Now this is where we get into the cool stuff. In my talk I explained “underriding” core framework classes (I guess it’s actually called monkey patching, thanks to Tony Hillerson for teaching me this). I first learned about this technique on Michael Labriola’s blog. In this example I use the resize/drag component that I made and apply it at the base mx.core.UIComponent level. This means that every single framework class that extends UIComponent (every ui component in the Flex SDK) will have the ability to use the resize handles. No need for an extra wrapper container, or an extended ResizableImage or anything like that. It just works. Isn’t that cool?
Demo | Source Code
I didn’t even get to this in my presentation, I ran out of time and skipped it. I’ll probably do a longer blog post about it in the next few days, but for now here’s an example with code for MXML templating. The basic idea is that I created a base “media player” class that included a progress bar to indicate the playhead time and a play/stop button. Then I used that class as the “template” and extended it to play a wav file and display the filename. Then I extended that to play an mp3 and display the id3 info in the component. And the last extension plays a video and displays the playing video in the component contents.
Thanks to smart people
A HUGE thank you goes out to all the awesomely smart people in my session that ran the thing for me. I’m going to write up a more detailed post with my thoughts on how the session went later, but I want to give a big thank you to Deepa Subramanian (for just being overall badass and answering a ton of questions), Andy McIntosh (for rocking the commitProperties discussion), Tony Hillerson (for monkey patching his way into the session), Adam Flater (for teaching me about [Mixin]), and David Coletta (for sharing his experiences with custom components while working on Buzzword). The session was fun because I got to sit back and let these guys teach everyone how to do custom component development.
- A while back Ben Clinkinbeard asked a question on flexcoders saying "Am I the only one who wishes EventDispatcher exposed its listeners?" The fundamental issue was that he wanted to get a list of all the event listeners that had been added to a given component. The approach: using FlexSprite…
- I've been reflecting on how my session at 360|Flex went. Overall I was very happy, I really enjoyed the communal vibe we got going with the discussions. The session ended up being a conversation among developers. I started out giving a presentation with slides and all that jazz, but that…
- Since the next 360|Flex is fast approaching, I thought I'd post the full recording of my session at the last 360|Flex in Seattle. You can do whatever you want with this video, embed it wherever, watch it wherever, you can even download the original mp4 video file. Hopefully the embedded…