Flex/Flash/Actionscript

Presenting at Lunch 2.0 at Adobe on Friday Sep 14

Come on by Adobe’s SF office this Friday from 4-6 pm for Lunch 2.0 (lunch at 4-6pm? wtf?). I’ll be showing off some cool Flex/AIR stuff (read: bouncing tilez!). I think the whole event is pretty informal, so come on by and hang out.

Side note for alcoholics: I asked if there was going to be beer and I was told there will be pizza. So I’m a little worried about the booze situation. Dear Adobe: you have set the bar very high with the past Flex events. It is now expected that we will walk in, get handed free software worth hundreds of dollars, and have all-you-can drink beer. If not, the Microsoft Silverlight Dev Camp will have drinks from 7-10 pm that same night. AND they might be taking people out for drinks after 10. I say we all walk from Adobe to the MS event after the Adobe one finishes. We can all wear Flex jackets, roll over with a hundred guys, and challenge the Silverlight devs to a street brawl. At the moment the Adobe rsvp list is 178 deep, while the MS one only has 89. We can take ’em.

All joking aside, if people actually do want to go from the Adobe event to the MS event, I might be down to walk over. I’m technology agnostic when it comes to free booze.

Standard
Flex/Flash/Actionscript

Download My Recorded 360Flex Presentation Video

The 360Flex folks have posted some of the recorded videos of the conference. You can see them all here, or here’s a direct link to mine. You can download the whole thing (my video is 280 megs). They’re selling the vids for $3.60, I think I get some kickback if you buy mine, although I’m unsure of the details.

So buy that! I’m gonna make millions. And I’m competing with Juan Sanchez for video “views,” so if you just want to go to the page and hit refresh a lot on my video that would help 🙂 I’m gonna be a millionaire AND a cheat!

Standard
Uncategorized

Facial hair as a measure of coding progress

Not sure if I’m the only programmer who does this, but I often use my facial hair as a visual indicator of how long I’ve been working on a project. I typically employ this technique on short projects with a lot to accomplish and little time to do it in. For example, yesterday I finished a project that was originally scheduled for about 3 full weeks. After week one we figured out that the deadline was 2 days before we thought, so we lost 2 days off the last 2 weeks, which is a fairly substantial portion of time on such a small timeframe (and don’t forget to add in labor day weekend festivities). So the shaving stopped (showering continued on a sporadic basis). Honestly, when you’re in a time crunch there simply aren’t enough seconds in the day to shave. And I like being able to look in the mirror and have a visual representation of the work I’ve been doing. An added benefit is the refreshing feeling that comes after work is done and the scruff is removed. Ahhhh, vacation time…

facial_hair.jpg

P.S. Yes, that’s just under two weeks of hair growth, my facial hair is pathetic, I can’t grow a real beard. You can stop making fun of me now.
P.P.S. I swear I’m going to get back to Flex related posts soon. There’s gonna be a bunch of flexlib updates coming. w00t

[UPDATE] Tink and Ben Stucki posted WAY better examples than my own. I had to share. If you’ve got anything better post a link in the comments.

Standard
Flex/Flash/Actionscript

Yes!! Thank you Flickr for crossdomain.xml

Throw away those Flickr proxies! They added an open crossdomain file on http://static.flickr.com. Fuck yeah! Read the blog post here. You can see the crossdomain file here: http://static.flickr.com/crossdomain.xml. Thank GOD. I no longer need to route every single Flickr image through my server just to get access to BitmapData for an image. This is one of those things that bugged me so much about Flickr. They gave us a nice open crossdomain file on their server we use for api calls, but not on the server that gives us images.

w00t!!

P.S. I usually don’t do these rehashing of blogosphere posts, but this one makes my life a helluva lot easier, so I wanted to share in case anyone missed it.

Standard
Flex/Flash/Actionscript, Uncategorized

What I learned from my 360Flex session

360Flex logoI’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 quickly got sidetracked and we ended up just sort of shooting the shit and sharing different tips on custom component development. Awesome. That meant I was able to chill and let everyone else teach the session. It kept me interested, and I hope it did for everyone in the session too.

David Coletta took notes during my session (as he did for all the sessions he attended at 360Flex, friggin good work with the notes David). I should also point out that David contributed a lot to the discussion while he was note-taking, impressive! Dan from polygeek.com has some thoughts on the session as well. He wrote that the “session itself was sort of open source,” which I think is really cool that that’s how it turned out. There are a few more notes on the session from some guy named Dave. Apparently he overheard someone say “will there be notes posted from this meeting? This is really kind of scattering my thoughts.” I worry that it was a bit too incoherent, I definitely jumped from slides to code to pulling up random websites to discussion. I hope it was a good balance for people, but I could see how it might have been difficult to follow.

If you have any thoughts about what you liked about the session and what you didn’t, please email me and let me know, or leave comments.

The thing I liked the most about the session is that I learned a bunch of stuff. I don’t claim to know everything about developing custom components, a lot of the people in my session knew a ton more than me. Here’s a list of the things that I learned during the session:

  1. I suck at properly using commitProperties and invalidating properties correctly for optimal component performance. This was pretty hilarious during the session because before the session I was talking to Deepa and she asked if I was going to go over when to use commitProperties and using dirty flags for property validation and all that. I said that I don’t know how to do that, I end up not doing it in my code, so no, I wasn’t going to cover it. She was appalled. It was like I told her I’m naming my first child Silverlight. So then the funny part is that I’m up there at the podium and the very first question that was asked was Andy McIntosh asking “Doug, can you explain when to use commitProperties?” I almost died, it was hilarious. So I promptly responded that no, I don’t know a good explanation of the proper use of commitProperties, would Andy like to discuss how he does it? And then Andy and Deepa taught the session for a while while I took notes. Awesome.
  2. Monkey Patching is a sweet term. I called it “underriding” classes in the framework, not sure where I got that term, it’s certainly not a “correct” term, but I didn’t have anything better. So then Tony Hillerson pipes up and tells me that in other languages there’s a term called monkey patching that is used to describe pretty much the exact same thing. Cool, I had no idea.
  3. There’s a [Mixin] metadata tag. I had never even heard of this. I was going over using a static function to initialize default styles for your component and then Adam Flater yells out that you could use the [Mixin] metadata tag and that would allow you to have an init() method that would get called once for your class. So in the session I pulled up the blog post on Adam’s site and we went over the code straight off his blog. Cool.
  4. I sound like Tom Hanks with Tourette’s. I disagree with this one, but it’s hard for me to judge my own voice. Doug Schmidt seems pretty adamant about this, so it must be true.
  5. Other random stuff. When we were talking about styles vs properties on custom components Tony talked about using both styles and properties to define the same property, which meant that a developer could take their pick and use either the property or the style (ie they could do it all with CSS if they want, or all via direct properties in AS). Nice, hadn’t thought of doing that. We all bitched about not being able to reference static variables for our Event names in the Event metadata. Doesn’t seem like anyone’s found a solution to that one (same for defining possible enumerated values for properties in the Inspectable metadata tag). Someone else mentioned that when I was showing my custom event code I had forgotten to have a Event.clone() function to clone the custom event. Yup, my bad, good catch. That’s what I love about participatory audiences.

We ended up covering a lot more material with a lot more expert knowledge than I would ever have been able to provide on my own. I think maybe instead of a single presenter running a session we should think about doing more panel-like discussions on a specific topic. Get four or five badass Flex devs together, have one person in charge of making sure things don’t get completely off track, and then just let the discussion take over. Let everyone share the tips that they know. It might end up being the worst session ever, but I think it would turn out really well. What do you guys say… Deepa, Tony, Andy, Adam, David, you all in?

Standard
Flex/Flash/Actionscript

My 360Flex slides and code

Here are the slides from my presentation at 360|Flex, as well as most of the code I presented. The presentation is embedded below using SlideRocket, or you can view it at the standalone link here.

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?

Templating example
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.

Standard
Flex/Flash/Actionscript

Ready for 360Flex and a bit about my session

Well, almost ready. Mohawk? Check. Silly shirt with my silly face on it? Check. Presentation? Ummm, it’s coming along…

mypicture.jpg

Here’s the brief description I finally wrote up about my custom component development session:

This session will focus on advanced component development techniques. We’ll cover some of the basics to make sure everyone’s up to speed, but the focus will not be on updateDisplayList() or createChildren(). Topics that will be covered include: diving deep into the framework to find the meaning of life, overriding the framework to create the components you actually want, using events to communicate from your components, using styles and setting default styles for your components, ‘underriding’ base framework classes like UIComponent, MXML templating, how to deal with pesky private variables when overriding a class, and how to steal other people’s ideas (and code) to make you look smart.

I’m still working on the presentation and I have absolutely no idea how I’m supposed to take up an hour and 20 minutes. Like that description hints at, I’m going to try to focus on what I consider the “non-standard” stuff in component development. I’m not going to make a Hello World Flex component. I’ve got a few cool tricks to show (at least I think they’re dorky cool), and I’ll cover some of the harder stuff like doing good event dispatching from your components and using styles correctly. If I run out of content the session will devolve into a “bitch about what you don’t like in the Flex framework” session, and I have a feeling we’ll be able to fill up a substantial block of time with that.

Want to hang out? Come to 360Flex.

Standard