Thursday, April 29, 2010

Video: Reflection Container in Flex 4, Part 1

Creating a Reflection Container in Flex 4, Part 1, the next episode in the gripping and suspenseful series CodeDependent, is now available from Adobe TV.

This show is based on one of the 65+ demo applications that I wrote for Flex 4 Fun, a book about the graphics and animation side of Flex 4. You can see a book sitting next to me on the table at the start of the video. I had planned to show it in the video, but that segment got cut. I suppose the producer figured that since all I was showing was a copy of When I am King... with a printout of the Flex 4 Fun cover taped around it (since Flex 4 Fun isn't actually available in hardcover until this Summer), it really wasn't a crucial part of the show. Anyway, if you want to see more about the book, check out the book site, the page where you can purchase the PrePrint version, or the apps site where all of the demos are hosted.

This episode shows how to create a simple container in Flex 4 that holds both a BitmapImage and that image's reflection. The actual reflection we end up with, which is just a translucent/mirrored version of the original, could be improved upon... which is the point of the next show. (Oooh, I just love a good cliffhanger!)

Here's the video:

Here is the demo application:

And here is the source code.

Here's where you can find CodeDependent on iTunes.

And here's where you can find CodeDependent on YouTube.


Monday, April 26, 2010

States and Components in Flex 4 has posted another article/demo from my book Flex 4 Fun. Check out States and Components in Flex 4 to see an example of the simple new state syntax in Flex 4 for including and excluding objects in different states of an application.

Tuesday, April 13, 2010

Bending Pixels with Flex 4 has posted one of the demos from my book Flex 4 Fun in an article on their site. Check out Bend your Pixels with Flex 4 to see a simple example of using a Pixel Bender shader to get a grayscaling effect on an image.

Wednesday, April 7, 2010

Video: Event Performance in Flex

Event Performance in Flex, the next episode in the gripping and suspenseful series CodeDependent, is now available from Adobe TV.

This episode covers the use of the updateAfterEvent() function to get better rendering performance for time-sensitve operations like mouse-interaction visuals and animations.

By default, changes to the graphics that the Flash player displays happen at the frame rate of the player (by default, 24 frames per second). This frame rate, which updates the screen every ~42 milliseconds, is fine for most visual changes on the screen. But when you need motion to be smoother, like in some animations, or need the visuals to respond quickly to user interactions, like changes in component state based on mouse movement or presses, then 24 fps may not cut it. In this case, you need to know about the updateAfterEvent() function found on some event objects.

Here's the video:

Here is the demo application:

And here is the source code.

Here's where you can find CodeDependent on iTunes.

And here's where you can find CodeDependent on YouTube.


Monday, April 5, 2010

Flex 4 Fun: Available in PrePrint

Chet's handy AcrtionScript algorithm for writing a programming book:

public function writeBook():FinishedManuscript
 var manuscript = new FinishedManuscript();
 while (true)
 // TODO: Next line never executes
 return manuscript;

Finally, after months of writing, editing, revising, coding, explaining, revising, deliberating, cogitating, revising, formatting, reformatting, revising, snapshotting, describing, captioning, revising, and dying a little inside, my book Flex 4 Fun is finished. Almost. It just needs a little more editing and revising.

The book is content complete: all of the chapters are done, all of the demo applications compile and run, all of the text is correct as far as I know, and there are no known typos.The book could still benefit from one more review cycle, but rather than wait for that plus the printing delay until it would actually be available on bookshelves (usually 2-3 months after a book is completely complete), I wanted to push out this early version close to last month's Flex 4 release.

Flex 4 Fun is different than other Flex, or Flex 4, books I've seen; it focuses on the graphics and animation side of the SDK. I figured that's what I like to play with on Flex, it's what I know best about the platform, and it deserved a book that went deeper into these topics than the other Flex books. Sure, an overview book is good to have. Yes, you should understand how to connect Flex to a back end. Alright, you probably want to understand how to architect large Flex applications. But when you get around to creating better user experiences for that Flex client, you'll want to know more about graphics, states, skinning, and animation. And hopefully this book and its 65+ examples can help teach you how that stuff works.

Here's the books Contents page:

1. Introduction 13 2. Graphics 18 3. Filters: Easy Image Processing 60 4. States 96 5. Transitions 105 6. Skinning Components 119 7. Animation 138 8. The Animation Class 152 9. Flex Effects: The Basics 184 10. Effect Choreography 209 11. Advanced Flex Effects 230 12. Go Have Fun 258

The book is available in PrePrint form on Go check it out and have some fun!

Friday, April 2, 2010

Flex 4 Fun: Coming Soon. Really Soon.

Here's another teaser for my Flex 4 book, coming soon from Artima Press:

(nifty cover picture by Romain Guy, Android hacker and photographer extraordinaire).

As you might expect in a book by me, Flex 4 Fun dives into the graphical and animation side of Flex 4. Lots of applications (>65) that demonstrate the technologies and techniques are covered in depth in the book and will be available on the book's website in binary and source form. Plenty of stuff to play with for those wanting to learn more about the "fun" side of Flex.

The book should be coming out in PrePrint form any day now. Artima's PrePrint is like a beta release of the book. In this case, the book is complete and has gone through a thorough editing/revision cycle (for some chapters, two or three times). But it still needs a technical review and feedback from careful readers like you. And you. And you. But in the interest of getting it out in your hands and minds close to when Flex 4 was released, we're releasing this early version while I work on finalizing the content in parallel.

Video: Using Flexy in a Flash Project

Using Libraries in Flash Pro, the next episode in the gripping and suspenseful series CodeDependent, is now available from Adobe TV.

This espisode is the stunning conclusion to the previous nail-biting cliff-hanger episode, Creating a Reusable Animation Library, in which we saw how to use Flash Pro to create Flexy, a small and Flex-free version of the timing engine underlying Flex effects. In this episode, we see how to use Flash Pro to link against Flexy and use it to create a simple ActionScript-based animation, writing code that looks very close to what we would write in Flex 4 for doing the same animation.

Once again, my thanks go to Trevor McCauley for helping me figure this out. Trevor's on the Flash player team and is very helpful is figuring out all kinds of things about how Flash works, including this bit about Flash authoring. Check out his blog at

I should probably spend more time and words on the Flexy library itself, but that will have to be for another day and another blog entry. But check out the previous episode for more information, and use your vast knowledge about the Flex Animation class and the related classes that you've accumulated so far from my blog and videos. It all carries over to Flexy, because Flexy is basically a subset of what I've been talking about with Flex 4 effects. It's just the timing engine part of effects (the 'Tween' engine, in Flash parlance), plus a helper class to assist in setting the animated properties on the target objects.

But for now, I'll just stick with the content of this show.

Here's the video:

Here is the demo application:

Here is the demo code. This is the Flash Pro project (FlexyTest.fla), which links to the Flexy library itself (Flexy.swc).

Here's where you can find CodeDependent on iTunes.

And here's where you can find CodeDependent on YouTube.


Thursday, April 1, 2010

Video: Animation Rules on

Romain Guy and I gave a presentation last year at Devoxx (an excellent developer conference in Antwerp, Belgium (a city with mildly miserable weather at that time of year)) called Animation Rules! A recording of this session was just posted on I've embedded it here for your viewing pleasure:

You could also check it out on the Parleys site directly; parleys is an excellent Flex application, and has a desktop AIR client for offline viewing of the various sessions.

The Devoxx conference posts the session recordings one by one throughout the year. But you can also subscribe to parleys to get all of the sessions immediately. There are many great sessions at the conference, and the fee is quite low (49 Euros for 6 months), so consider becoming a subscriber to get it all.