Thursday, December 2, 2010

Slides from Recent Android Presentations

Here are slides for two of the approximately 871 talks that Romain Guy and I gave at Devoxx last month (and again at the SF Android User Group meeting a couple of days ago).

Videos of all of the Devoxx sessions are already posted on the excellent Parleys site for a small subscription fee, and should be made freely available sometime in the next few months. You probably want to check out those videos for the complete details. But in case you were at the talks, are sick of listening to us speak, or simply want to peruse the slideware, here you go...

Android Graphics and Animation

Android UI Development: Tips, Tricks and Techniques

Saturday, November 27, 2010

Flex 4 Fun 4 Kindle

By popular demand, Flex 4 Fun is now available for the Kindle!

If you order the eBook on the Artima site, you can download the Mobi as well as the PDF version. In fact, if you already bought the eBook, you can log into your Artima account and download the new Mobi version. Once you have the .mobi file, you can copy/email it to your Kindle device and start reading.

Sunday, November 21, 2010

Shaka Devoxx

I'm back from the annual Devoxx conference, a fun and thoroughly exhausting week in Antwerp spent presenting, attending, and generally hanging out. It's always a great time, despite the weather and the overall grayscale cityscape.

This picture from the show was taken during one of my sessions when I was either talking about a GUI frame or saying hello to my Hawaiian friends.

I presented in several sessions, including 4 sessions with Romain Guy about Android and UI programming and one on topics from my book, Flex 4 Fun. I spent most of the week either on stage or writing slides and demos to present on stage. There's nothing like procrastination to keep you busy at the last minute.

For anyone that missed the presentations, see below about their availability on parleys.com. We may also post the slides someday, although it's always better to get the full deal (slides+audio+video). Also, I intend to post a couple of the demos I showed in the Android talks (the Flex demos are already available on the book site).

The sessions this year were, as always, recorded and will be released on parleys.com, an excellent site for viewing presentations with lots of content from previous years as well as other developer forums. The talks are released incrementally during the year for free, or you can buy a subscription to view them all for 79 Euros. In fact, parleys just announced that the 2009 recordings are now all available and all free. The talks and the recordings are of very high quality, so you should check out the site..

Anyway, thanks to Stephan Janssen for another great conference. Shaka!

Friday, October 29, 2010

Amazon Restocks Massive Shelves

Flex 4 Fun is finally, once again, in stock at Amazon.com. It's been "Temporarily out of stock" for the past coupjle of weeks for reasons that escape me, but which are probably one of these two possibilities:
  • Amazon is really new at this business of selling books and is still learning how to keep appropriate amounts of inventory on-hand.
  • They lost all the copies they had and had to rewrite the book from scratch, based purely on the cover picture on their website. I hope their version is as gripping as the original.
In any case, you can now order it in peace. At the same time, they bumped the price a bit, to $26.60. This is fantastic news, of course, for two reasons:
  • The book now costs just about a cup of coffee more than it used to on Amazon. This means that you may have to forego that cup when you read it, thus preventing unfortunate spills and mess.
  • Even better, the new price means that the book is just over Amazon's Free Shipping limit here in the U.S. That's probably the thing that a lot of you were waiting for in order to finally purchase it.
So go ahead. It's ready. Now. Go.

Saturday, October 9, 2010

Speaking of Flex...

I'll be joining Jacob Surber from Adobe this week to speak to the local Flex user group, SilvaFUG (which I think stands for "Silicon Valley Flex User Group." Or maybe it's "Silver and Fugly"). We'll be in San Francisco on Tuesday evening (the 12th) and San Jose on Thursday evening (the 14th).

The topic is "Fun with Flex Skinning." I'll start off with an overview of the visual aspects of Flex 4 (which, by bizarre coincidence, are exactly the topics covered by Flex 4 Fun. Funny how that worked out). Then I'll walk through an extended example of skinning a simple component to show how these visual elements are used to enable easy development of very custom-looking components. I promise there will be much more code than bullet-points. Jacob will then go into more detail about skinning, including possible workflows and tools for design and development of custom components.

More information about the events can be found on the SilvaFUG site.

I hope to see you there; it should be a Flex 4 Fun evening. Both times.

Monday, September 27, 2010

Flex 4 Fun: Only n left-- order soon!

Flex 4 Fun is finally available for purchase at Amazon. First, it went from looking like this on their site (with the depressing "Temporarily out of stock" message):

to looking like this, after they were finally ready to ship it out (I figure they probably wanted to dust off the copies first, then put them on the shelves to see how nice they looked):

Then for the past few days, the amount of stock appears to continuously change. In fact, they seem to have a hard time figuring out how much stock to keep on hand. Here are some screenshots from the Amazon page over the past few days. (Not that I've visited the site that many times or anything. After all, I already have a copy, so why would I need to? That would be silly.)

Get yours soon. Who knows when they're going to run out completely?

Oh, and don't forget about that free shipping for orders over $25 thing. Amazon toyed briefly with a price just over $26. And I mean briefly. I saw it at that price just once over the past two weeks. Now it's down at $24.39 (below the $24.93 price before it was in stock, in the first image above). Apparently the book is like pork bellies or flax futures and the price fluctuates with demand. Or their clerks just get the numbers transposed occasionally. Since it's so close to the free shipping limit of $25, you'll probably want to bundle it with another relevant, yet highly affordable book, like When I am King.... I'm just saying....

Saturday, September 11, 2010

Book Montage

I ran across Flex 4 Fun in the wild this weekend and managed to get some photographs. I thought that it might help you to understand how you might benefit from the book. Here are some ways that others have found it useful.

First of all, the book makes a lovely objet d'art, and was being displayed alongside other great works of art when I encountered it here:

It also makes a nice decoration for some household areas, such as this aquarium:

This person apparently found the code recipes useful in the kitchen:

At 280+ pages, the book is a perfect size for some household tasks, such as leveling this piece of furniture:

A good graphics algorithm is always music to the ears:

This family apparently found the book more interesting to watch on a Friday night than television or a movie:

And of course the book looks great on a bookshelf, where it fits naturally with both the great works of literature:

and the less great works of children's literature:

But the book won't stay on that kids' shelf for long:

Even the family pet may enjoy the book - everyone wants to be an RIA developer:

And finally, this Flex developer was so excited by the book's arrival that he bought two:

As you can see, there are plenty of uses for the book. What will you do with yours?

Thursday, September 9, 2010

Done? Done. It's Here.

For anyone that doubted the outcome (including me), I offer the following physical proof that Flex 4 Fun exists. I received a few of the early copies today, and I took a picture of one in its natural habitat. I wanted to capture how nice the book would look on a random bookshelf. Here, you can see it surrounded by a few of my other favorite books:
This is probably as good a time as any to call out to some of the many people that supported me in this huge and questionable effort:
  • Romain Guy: Thanks for the ideas, the help, the beautiful pictures (including the lovely and bizarre sea dragon on the cover), the foreword, and the encouragement. I only regret that you didn't actually write the book with me instead of just making me get started on it to begin with. But I'm learning that there's not a lot of time outside of Android development to take on that kind of project...
  • Daniel Steinberg: Thanks for helping me get the project rolling at first and giving me some great advice and editing assistance. I'm sure it's a better book for your help.
  • Bill Venners (a.k.a., the publisher): Thanks for taking the book on and getting it out there in very quick order. Making it available early in online form that close to the Flex 4 release was important, albeit painful and nearly impossible.
  • The academy: For voting for me and sucking up to me throughout my Hollywood career, I thank you most of all. Always thank the academy.
The books are being sent out to distributors starting this week. Amazon still shows the book as "Available for pre-order", but I expect that to change next week as they start receiving their copies. Assuming they can bear to part with the little darlings.
(By the way, this blog entry is reminiscent of an earlier one. My, how the time flies when you're too dang busy working on code and writing books about it...)

Wednesday, September 1, 2010

Final Article: Effect Choreography in Flex 4

Artima.com has posted another article from my book Flex 4 Fun. Check out Effect Choreography in Flex 4 for an introduction to using composite effects in Flex 4 to create more complex animations.

For anyone that's tired of seeing Flex content on my blog, you're in luck: this is probably the last bit of such material for the foreseeable future. This article is the eighth and last in a series of articles that were, er, borrowed from the book.

(Then again, if you're tired of my Flex content, I have no idea what you're doing reading this blog to begin with).

If, instead, you're pining for more content, might I suggest picking up Flex for Fun? The online version is done and the printed version is so close I can almost taste it (although I hope it reads better than it tastes).

If you're hoping to see some Android content, be patient. I'll get there eventually. I'm a tad swamped in actually writing SDK code and learning the platform first. I'll eventually come around to posting some geeky how-to developer content here. Because that's what this blog is all about.

Monday, August 30, 2010

Skinning Components in Flex 4

Artima.com has posted another article from my book Flex 4 Fun. Check out Skinning Components in Flex 4 for an overview of the awesome new component/skinning architecture in Flex 4.

Flex 4: Get some skin in the game...

Tuesday, August 24, 2010

Linear Gradients in Flex 4

Artima.com has posted another article from my book Flex 4 Fun. Check out Linear Gradients in Flex 4 for an overview of using linear gradients in the new graphic primitives in Flex 4.

Tuesday, August 17, 2010

Flex 4 Fun: Amazon Existence Proof

There's a basic philosophical question that is fundamental to so many situations in life:
  • If a tree falls in the forest and nobody is there to hear it, does it make a sound?
  • If you tell a joke and nobody hears it, is it funny?
  • If your children respect you, are they really teenagers?
The equivalent in the book world is:
  • If your book isn't sold on Amazon.com, has it really been published?
I'm happy to say that Flex 4 Fun now passes this last existence proof; the book is available for pre-order on Amazon.com. The book is at the printers now, supposedly available in hard-copy in mid-September. At Amazon's discount of 34% off the list price of $36, it seems like a pretty good deal to me.
Notice that the Amazon price of $24.39 is just shy of the $25 you'll need to reach for free shipping. Which is probably just the excuse you were looking for to finally pick up When I Am King....
By the way, if any reader is so inspired, it would be great if you posted a review on Amazon (and elsewhere). I know how I feel about my books, but I'm slightly more subjective than you might be. Besides, I already used up my quota of words in the books themselves. It's time for me to shut up and let someone else talk. Briefly.

Sunday, August 15, 2010

Flex 4 Fun: Final Post(PrePrint)

As promised, the eBook of Flex 4 Fun has been updated to the final version of the text, which was uploaded for printing last week. So if you bought the eBook already, a fresh download will give you the final bits.

If you didn't buy the eBook version already, what are you waiting for? Oh, you want the hardcopy version so that you can enjoy its graphical goodness in the way that Gutenberg intended? Well, you'll still have to wait a bit for that. Even now, armies of typesetters are setting up printing presses to make a run at printing the tome. Look for the book in bookstores and online in mid-September.

Thursday, August 12, 2010

Fills in Flex 4: It's What's on the Inside that Counts

Artima.com has posted another article from my book Flex 4 Fun. Check out Fills in Flex 4 for an overview of fills for the new graphic primitives in Flex 4.

Tuesday, August 10, 2010

printf(Flex 4 Fun);

If you listen closely, you can probably hear it; the slight rustling of hundreds of pages, the chuckles of the shop foreman as he reads the section headings and subtle footnote humor, the collective sigh of the machinery as it mass-produces page after page of graphics programming wisdom.

After months of writing, followed by many more months of editing and revising (it's still unbelievable to me, and more than a little depressing, to know how much you can continue working on your own text and still find things to improve), Flex 4 Fun has gone to print. It's a bit like being put out to stud, except that books are self-reproducing and there's little chance that one of the offspring would win the Triple Crown.

If all goes well at the printer, there should be hardcopy available in mid-September, right before the JavaOne conference, and in plenty of time for your holiday programming-book-giving needs. Just imagine what your mother will say when she opens that completely unexpected gift.

For anyone that bought, or is thinking about buying, the online version, the PrePrint will be updated soon with this version of the text. I'll post something here when that happens.

Monday, August 2, 2010

Stroke of Genius: Drawing Lines in Flex 4

Artima.com has posted another article from my book Flex 4 Fun. Check out Stroke of Genius: Drawing Lines in Flex 4 for an overview of the stroke object, used for defining the properties of lines and outlines for the new graphic primitives in Flex 4.

Sunday, August 1, 2010

Varargh!

Varargs, a feature of the C language since roughly the late Victorian era, was introduced into the Java language in JDK1.5.

I love varargs. They allow me to declare a function flexibly with the ability to take zero, one, or several parameters. This ability is useful when the user may have an unpredictable number of things to add to some data structure, eliminating the need for them to create some collection to pass the parameters into your function. It makes for a nice API. And I'm all about nice API. (And donuts).

But sometimes varargs don’t work so well. I suppose it’s because I expect too much of them. Like when you meet someone that you really like, so you call them every few minutes or so, then hang around outside their apartment and workplace and friends' houses until they get a restraining order on you. It’s not that they weren’t really cool and worth getting to know, but that your needs weren't necessarily compatible.

I was working recently on some API improvements for a library I'm writing. I had some constructors that users would call with exactly two values of different types, like this:

  public MyObject(int value1, int value2) {}

  public MyObject(float value1, float value2) {}

This worked well, vectoring the code path off in different directions depending on the types of the values that the user passed in.

But sometimes, the users might have just one value to pass in. Or three. Or nineteen. Rather than having variations for all of these situations, multiplied by the number of types that I wanted to support, I wanted something simpler that took variable numbers of parameters.

So I rewrote my API with varargs. It looked something like this:

  public MyObject(int... values) {}

  public MyObject(float... values) {}

This new version was awesome. Now the user could call my functions with the appropriate values and it would do the right thing, no matter what the types were or how many values they passed in. I compiled the code for the library, wrote my test code:

MyObject obj1 = new MyObject(1f);
MyObject obj2 = new MyObject(1);

and

FAIL

I got a compiler error. Specifically, Eclipse gave me the following completely unhelpful message for the test code: “The constructor MyObject(float[]) is ambiguous” for the second line of that test code (MyObject obj2 = new MyObject(1)).

Never mind the fact that the error was telling me that the constructor takes an array instead of varargs; I know that varargs is syntactic sugar for a construct that gets turned into an array. The real problem was that my code wouldn’t compile.

Apparently, varargs cannot handle the method overloading situation and make the correct type inference and just fails to compile. Although the compiler can make a good decision about the correctness of a constructor with float vs. int, it can’t make that decision for float[] vs int[]. So it bails.

Meanwhile, I discovered another nuance of using varags; you can’t pass them around between constructors willy-nilly. One of the things I wanted to do in my rewrite was to record the type that the user wanted to use and send it to a private constructor like this:

private MyObject(Class valueType, Object... values) {}

Meanwhile, I wrote a single type-specific constructor (to avoid the previous compiler error for now) that called this more generic constructor:

public MyObject(float... values) {
 this(float.class, values);
}

Again, my code compiled fine. And when I eliminated one of the float/int varargs combinations, I was able to write a test that successfully called my varargs constructor:

MyObject blah = new MyObject(1f, 2f, 3f);

This code called the private Object-based constructor above. But then I encountered bugs at runtime where the number of values was not what I was expected. In particular, the number of values being stored by the private constructor was 1, not 3.

But, but, but, ...

It turns out that the call to the private constructor turned a perfectly fine threesome of parameters of type float into a single parameter of type float[]. That is, my varargs had just turned into the array that it was pretending it wasn't when I first wrote the code.

At this point in an article, the climax as it were, I would typically say, “And here’s how you work around these issues.” I would love to do that, because I like neat tricks and workarounds. And I’d love to actually have that workaround in my code.

Unfortunately, I have no such workaround. I frankly don’t know how to make this work in any reasonable way. You can be more clear with the compiler, by telling it things like new MyObject(new float[](1f, 2f, 3f}) to get around the compiler error. And maybe you even like the way that that looks for an API. If you are sadistic. Or hallucinating. You could also find a different way to store the individual parameters in the varargs rather than having the VM think that it’s just a single array item. But at this point, my original attempt at a more attractive API and flexible implementation was looking like a bad prototype or an industrial accident.

So I did the only thing that any responsible captain would do after his vessel had hit an iceberg and was going down with all hands: abandon ship on the first lifeboat.

For my situation, I could limit the flexibility to just one or two parameters for the main case, and then have a completely different constructor with a custom data structure for the more flexible, and less common, case of having several parameters. So I walked away from varargs completely for my code with nary a look back. The second problem of calling the private constructor with varags then magically disappeared because I no longer had to pass the varargs around.

For other situations that may benefit from varags, but may run afoul of method overloading, I can only recommend that you know and understand the limitations of the nifty varargs feature. I searched around on the web for answers to my compiler problem and didn’t find anything immediately, so I thought it might be worth noting for posterity. Or at least for the pleasure of venting.

Varargs: great when they work. But when then don’t? Nobody knows. Maybe that's why the syntax uses ellipses. It's like a little language joke that says, "Sure, use varargs, Let's see what happens..."

Monday, July 26, 2010

State Transitions in Flex 4 for Intuitive UIs

Artima.com has posted another article from my book Flex 4 Fun. Check out State Transitions in Flex 4 for Intuitive UIs for an overview of using transitions to animate changes between states in Flex 4.

Thursday, July 22, 2010

Yes We Candroid

In case anyone's wondering when the next Flex CodeDependent video/demo is coming, the answer is... probably not anytime soon.
After a fun and productive Flex 4 release, I decided to get small; the time had come for me to do some mobile development. In particular, I wanted to work on Android. So a few weeks ago, I joined Google to work on the Android SDK. For starters, I'm working on animation support (surprise, surprise), but I'm sure I'll end up tinkering throughout the UI toolkit and graphics layers. You know, the fun stuff.
By the way, if you want to know more about this personal career decision, I'll try to answer all of your possible questions here, in no particular order:
  • Flex is awesome, Flex 4 is even better. Honestly, I wouldn't have wasted the last year's worth of weekends and evenings writing Flex 4 Fun if I wasn't totally jazzed about Flex 4 as a great client platform.
  • Yes, but only on Tuesdays.
  • The coffee is better.
  • Of course the comedy at chetchat.blogspot.com will continue! I'm not dead yet!
  • No
  • Maybe, eventually
  • Blue
  • Dental floss
Adobe's doing great things with Flash on Android and Flex on Android. But that's not what I'm doing here at Google, so I won't be posting much new Flex/Flash content here (although I still plan on doing some book-related articles and conference/user-group presentations). It's that finite-time thing - I'm going to be pretty busy just working on what I need to do for Android. I don't know if you've heard, but there's a lot of these devices out there these days; that's a lot of users that need even more awesome UI toolkit software...
For anyone interested in Android development, or in UI/graphics/animation development in general, stay tuned to this blog: I plan to post content here about all of that kind of stuff.

Wednesday, July 21, 2010

Flex 4 Fun: Real Soon Now

How credible would a software book be that didn't slip the schedule? That would be like sugarless dessert, or nonfat bacon, or an effective politician; it's just not believable.

So in keeping with the tradition of all software since 1954 (the original launch date of Windows Vista), Flex 4 Fun is hereby slipping its schedule.

But not by much.

The original goal was to have the hardcopy printed and available in early August. Failing the invention of a time machine, that's not going to happen. However, the book is actually done, at least from my perspective. In fact, the content that's been in the PrePrint copy for weeks is nearly final itself. The editing phase found many little things to clean up (it always amazes me how many times I can edit my writing and still find errors. It's as if I'm human) and resulted in some amount of reorganization. But most of the recent changes have just been about finalizing the layout in order to get it to the printer.

I don't have a final date yet, but I'm thinking it's sometime in September, just a few weeks after it's sent to the printer... which the publisher assures me is just about to happen.

In the meantime, check it out online or do like I do; wait impatiently and completely ineffectively.

Wednesday, July 7, 2010

Graphics in Flex 3 and Flex 4

Artima.com has posted another article from my book Flex 4 Fun. Check out Graphics in Flex 3 and Flex 4 for a comparison of drawing shapes in Flex 3 code versus using the new graphics classes and tags in Flex 4.

Friday, June 25, 2010

Video: Image Zoom Effect in Flex 4

Image Zoom Effect in Flex 4, the next episode in the gripping and suspenseful series CodeDependent, is now available from Adobe TV.

This episode shows a technique for zooming in on a particular area of a thumbnail image, transitioning to a higher-resolution image along the way. A friend had asked about ideas for doing this, and I thought the result might be generally useful or interesting, so here it is. I particularly like how you can zoom in on her enigmatic smile.

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.

Enjoy.

Monday, June 21, 2010

State-Specific Property Values in Flex 4

Artima.com has posted another article/demo from my book Flex 4 Fun. Check out State-Specific Property Values in Flex 4 to see an example and explanation of the simple new syntax in Flex 4 for declaratively setting per-state property values on objects to automate changes in the UI between states.

Saturday, June 19, 2010

Video: Animating Filters in Flex 4, Part II

Animating Filters in Flex 4, Part II, the next episode in the gripping and suspenseful series CodeDependent, is now available from Adobe TV.

This episode is the sequel and stunning conclusion to the previous one, Part I, in which we saw how to use, and not use, the AnimateFilter effect for animating filter properties in Flex 4. This time we see how to properly animate properties of filters which persist on objects when the animation ends.

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.

Enjoy.

Friday, June 11, 2010

Video: Animating Filters in Flex 4, Part I

Animating Filters in Flex 4, Part 1, the next episode in the gripping and suspenseful series CodeDependent, is now available from Adobe TV.

This episode shows how to use the AnimateFilter effect in Flex 4 to achieve certain effects like animating a blur. It also shows how the effect is completely inappropriate for some situations, which is a teaser for the next episode.

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.

Enjoy.

Thursday, June 3, 2010

Video: 3D Distortion

3D Distortion in Flex and Flash, the next episode in the gripping and suspenseful series CodeDependent, is now available from Adobe TV.

This episode shows how and why you might see some distortion with 3D objects in Flash and Flex (hint: it's about bitmap scaling).

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.

Enjoy.

Thursday, May 27, 2010

Video: Easier, Better Transitions

Easier, Better Transitions in Flex 4, the next episode in the gripping and suspenseful series CodeDependent, is now available from Adobe TV.

This episode shows how to use transitions more effectively by avoiding hard-coding the animation values in the effects, and letting the effects pick up the values from the states automatically, instead..

Here's the video:

Here is the demo application (in its final form):

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.

Enjoy.

Thursday, May 20, 2010

Video: Flex 4 States and Transitions

Flex 4 States and Transitions, the next episode in the gripping and suspenseful series CodeDependent, is now available from Adobe TV.

This episode shows how to use the new states syntax and transitions in Flex 4.

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

Here's the video:

Here is the first demo application:

And here is the second demo:

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.

Enjoy.

Friday, May 14, 2010

Video: Flex 4 Path to Enlightenment

The Path Object in Flex 4, the next episode in the gripping and suspenseful series CodeDependent, is now available from Adobe TV.

This episode shows how to create a simple drawing application using the new Path object in Flex 4.

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

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.

Enjoy.

Friday, May 7, 2010

Video: Upon Further Reflection

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

This show is the sequel to the previous one, in which I showed how to create a simple container for an image and it's reflection ... that didn't look that great. The sequel shows how to get a better, more realistic reflection effect by using blur, masking, and alpha gradients. My favorite part of the technique is something that I completely forgot to mention in the show: the code is soooo much simpler than code I used to write to get this effect prior to Flex 4. Check out this earlier show on a reflection effect using ActionScript and Flex 3 components. Now look at the few lines of code in the Reflexion container to get the same result. Nice, eh?

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

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.

Enjoy.

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.

Enjoy.

Monday, April 26, 2010

States and Components in Flex 4

Artima.com 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

Artima.com 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.

Enjoy.

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();
 writeDemos(manuscript);
 writeText(manuscript);
 while (true)
 {
    edit(manuscript);
    revise(manuscript);
 }
 // 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 artima.com. 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 senocular.com.

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.

Enjoy.

Thursday, April 1, 2010

Video: Animation Rules on Parleys.com

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 parleys.com. 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.

Enjoy...

Friday, March 26, 2010

Video: FlashCamp Boston Session Videos Posted

An event didn't really happen unless videos of it are posted to the web. So it must be the case that FlashCamp Boston really happened, because the videos are live.

All of the sessions from last week's excellent Flex-oriented event are now on Adobe TV at http://tv.adobe.com/show/flash-camp-boston/. These sessions include:

... and much, much more.

Oh, and I gave a talk on (what else?) Flex 4 effects, which I'll embed here because that's what I do on my blog:

Enjoy...

Monday, March 22, 2010

Coming Soon: My Flex 4 Book

Now that Flex 4 is released (yay!), it seems like a good time to announce that I've been writing a book about the graphics and animation side of Flex 4 (apparently I didn't learn my lesson the first time around, or I actually enjoy spending all of my spare time writing about what I spend my non-spare time developing). It should be a fun read with lots of eye candy demos with source code available on the book's website.

I'll have more details available in the next couple of days, and I hope to have the beta version of the book ready for online purchase within the week. (I actually hoped to have the real paper version available in stores this week instead. But that dream died a few months ago when I blew right past all of my deadlines. It's tough to finish a book about a product when you really need to finish the product first. So instead, I'll have a nearly-finished version of the book available online now, followed by the final version available online and in print hopefully sometime this summer).

Friday, March 12, 2010

Video: Creating a Reusable Animation Library

Creating a Reusable Flash Animation Library, the next episode in the gripping and suspenseful series CodeDependent, is now available from Adobe TV.

This episode is a bit of a departure from my normal shows. Usually, I show graphics and animation techniques in Flex and Flex 4. This time, I talk about Flash Pro, the authoring tool for Flash (not Flex) applications. In particular, I show how to create a reusable library in Flash Pro that you can then link to and use in other Flash Pro projects. The process of creating a library in Flash Pro wasn't obvious to me, so I thought it might be useful to show how it was done. Thanks 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 senocular.com.

Here's how this relates to Flex and my work for Flex: the library I create is an animation library based on the core facilities underlying the Flex effects. I call the library Flexy.

Flex effects are pretty dependent on the Flex library overall. They use concepts in UIComponent, graphic elements, styles, and other concepts that are found in the core Flex framework. So building a full-on Flex effects library in Flash Pro would necessarily drag in so much of the Flex infrastructure that it wouldn't be worth the effort; you might as well just use Flex directly.

But the underlying animation engine that the new Flex 4 effects depend on, including the Animation class, arbitrary type interpolation, and the new easer interface and classes, are independent of Flex effects and of nearly everything else in Flex. I wanted to see if I could break those animation facilities out into a separable library. There were various niggling dependencies, such as the use of the EffectEvent class, some use of resource bundles for error strings, and other minor issues, but one 50-minute train commute later, I had a 13k library built in Flash Pro that had no Flex dependencies and had all of the underlying animation support that the Flex effects use for running their animations.

Flexy doesn't handle all of the effects functionality, of course, because Flex effects aren't part of the port. Flex effects provide mainly two extra layers of support for animations. First, they handle setting animated values on target objects/properties. The animation infrastructure only handles calculating the animated values, not what to do with those values. Second, effects have extra built-in logic and convenience APIs that makes it easier to declare and run effects than you might otherwise have to do with a more manual approach to animation.

I can't do much about the second bit; that's most of the code in effects, and I was looking for something simple. But for the first part, I've provided a utility class called PropertyAnimator which you can use to automate assigning animated values to properties, just like effects do. It simplifies using Animation and makes very easy property animation possible with this library.

Check out Flexy and see what you can do with it. And come back for the next show to see a simple example of using the library from within Flash Pro.

Here's the video:

There is no demo application this time, because the demo is really just the reusable Flexy library, which isn't very exciting to watch, as demos go, because it just sits there, being reusable.

Here is the demo code. This is a zip file containing the Flash Pro project (Flexy.fla), the Flexy library itself (Flexy.swc), and the source code that Flexy was built with.

Users of the Flex Animation class should be able to start playing with the library pretty easily, but if the API is a bit of a mystery to you, check back for my next show, in which I'll dmeonstrate how to use the library in Flash Pro for a simple example.

Here's where you can find CodeDependent on iTunes.

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

Enjoy.

Monday, March 8, 2010

Music Video: Flex 4: It's a Wrap

Here's a music video I made for the 360|Flex conference. It's a tribute to the Flex 4 release and the Flex SDK team. I hope you like it, from the bottom of my geeky little heart.

Friday, February 26, 2010

FlashCamp Boston: March 19th

It's Flashy, it's Campy, it's ... FlashCamp!

There are some free FlashCamp conferences coming up in the next few weeks. These free events are great opportunities to learn what's new and upcoming in the platform, for free. I'll be speaking at the free FlashCamp Boston. And my topic will be ... Animation and Effects in Flex 4 (big surprise there). There are lots of other great speakers and topics, and there will be developers from the builder and SDK teams giving talks and generally available to answer your questions. For free!

Come on along to the free camp nearest you. For example, come to the free Boston event on March 19: be sure to register here; it's free, but there's limited space. Here's the current agenda for that free night:

5:00 - 5:45 p.m. Registration/Food/Drinks/Networking 5:45 - 6:15 p.m. Keynote 6:15 - 6:45 p.m. Overview of Flex 4 6:45 - 7:00 p.m. What's New in Flash Builder 4 7:00 - 7:20 p.m. Break 7:20 - 7:50 p.m. Animation and Effects in Flex 4 7:50 - 8:05 p.m. Introducing ColdFusion Builder 8:05 - 8:20 p.m. PHP and Flex 4 8:20 - 8:50 p.m. Creatiung Custom Layouts in Flex 4 8:50 - 9:10 p.m. Break 9:10 - 9:40 p.m. Advanced Skinning in Flex 4 9:40 - 9:55 p.m. SpringSource and Flex 4 9:55 - 10:15 p.m. Flash Builder 4 Secrets 10:15 - 10:30 p.m Flash on Mobile

(Did I mention that it's free?)

Thursday, February 25, 2010

Video: The Animation Class in Flex 4

The Animation Class in Flex 4, the next episode in the gripping and suspenseful series CodeDependent, is now available from Adobe TV.

This episode covers the new Animation class in Flex 4, which is the underlying timing engine used by all of the Flex 4 effects. You will usually use this class indirectly, by using Flex 4 effects, but you can also use the class directly, providing a target object for Animation to call as it calculates new property values each frame.

For anyone used to Flex 3 effects, Animation is the new Tween. It uses some of the same mechanisms, but has added many capabilities, like repetition behavior, to support the enhanced capabilities of Flex 4 effects. We also meddled a bit with the API a bit as long as we were in there (for example, it doesn't auto-play on construction, like Tween does).

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.

Enjoy.