Skip to main content

Posts

Showing posts from August, 2009

Scoping Strategies

I just fixed a lurking bug in my code today that was related to ActionScript's scoping rules. The bug wasn't obvious to me when I first wrote it, and took some head-scratching when I fixed it. So I thought I'd post in in case this behavior isn't obvious to anyone else eading this (say, coming from a Java background like I do, where this behavior doesn't exist). I'll boil it down to a simpler 'puzzler' question: What do you think this prints out? var i:int; for (i = 0; i < 2; ++i) { var blah:Object; trace("blah = " + blah); blah = i; } Or how about this? for (i = 0; i < 2; ++i) { var blarg:Object = null; trace("blarg = " + blarg); blarg = i; } (I'll put the answer at the end of this post, so that I don't blow the surprise for anyone wanting to figure it ou

Video: AnimateFilter in Flex 4

AnimateFilter Effect in Flex 4 , the next episode in the gripping and suspenseful series CodeDependent , is now available from Adobe TV . This show covers the new AnimateFilter effect in Flex 4, which allows you to animate properties on Flex filters. You could do this in Flex 3, but it required more custom effects or animations, where you would receive the animation events and manually update the filter properties. Now, you can pass in the filter and the animation properties to AnimateFilter and it automatically animates the filter properties. This is another example of Flex 4 effects being able to target arbitrary objects; in this case, it is changing properties on a filter, not on a component. The demo app also shows the new RepeatBehavior capabilities in Flex 4 effects, which makes it easier to create reversing effects, like we have on the pulsating button in the demo. Here's the video: Here is the demo application: And here is the source code . Finally, here's where you can

Pros and Cons

I just heard that my technical session was accepted at Devoxx, so I thought I'd post my upcoming conference schedule: Adobe MAX : I (along with others on the Flex team and a host of other knowledgeable people inside and outside of Adobe) will be presenting at MAX this year. I will give a talk on (drum roll please; it's sure to be a big surprise...): Flex 4 Effects! MAX is in Los Angeles from October 4 - 7 . Come learn about Flex, Flash, and other cool Adobe developer products. Devoxx : I, along with my co-author and arch-nemesis Romain Guy , will be presenting a session entitled "Animation Rules!," where we will apply lessons learned from cartoon animation to making better GUIs. There should be some other good talks more specifically about Flex as well. Devoxx is in Antwerp, Belgium from November 16 - 20 . It is one of the best geek conferences I've been to, year after year, with good, deep talks about Java, Flex, and whatever else is hot and worth learning abo

Video: Transform Effects in Flex 4

Flex effects: a transforming experience...... Transform Effects in Flex 4 , the next episode in the gripping and suspenseful series CodeDependent , is now available from Adobe TV . This show covers the new "transform effects" in Flex 4, which allow you to move, rotate, and scale Flex objects (components and graphics objects). Similar effects (Move and Rotate) exist in Flex 3 already, but these effects were completely overhauled in Flex 4 to make it easier to get them to do the right thing. One of the problems with the previous implementations of Move and Rotate is that they would sometimes clobber each others' results. If you think about it, both effects are affecting the (x,y) location of an object, so if the effects are giving conflicting advice, you may not get what you really wanted. For example, a Rotate effect in Flex 3 would rotate around the center of the object by default, meaning that the (x,y) location of the object would change as it rotated around that center

Video: Fade Effect in Flex 4

Old components never die; they just fade away. Fade Effect in Flex 4 , the next episode in the gripping and suspenseful series CodeDependent , is now available from Adobe TV . This show is all about the new Fade effect in Flex 4, which allows you to fade objects (components, graphic objects, and anything else with an alpha property) in and out. This effect exists in Flex 3 already, although it got a little reworking in Flex 4 to add useful functionality. For one thing, it uses the ability of the Animate effect to target arbitrary target objects (useful in the world of Flex 4, where we may have graphical objects in our application instead of just UIComponents). But also, the new Fade effect has a little more intelligence built into it that helps it figure out when you want to automatically fade things in and out, based on the value of related properties like visibility and whether the object is becoming parented or unparented between states of a transition. Here's the video: Here

Video: AnimateColor in Flex 4

AnimateColor in Flex 4 , the next episode in the gripping and suspenseful series CodeDependent , is now available from Adobe TV . This show is a follow-on from the previous show on the Animate Effect in Flex 4 , which talked about the superclass of the new effects in Flex 4. This show is all about the new AnimateColor effect, which allows you to animate colors on arbitrary Flex objects using the new type interpolation capabilities in the Flex 4 effects. While we showed how to do this with the Animate effect in the previous video, using AnimateColor is a more natural way to achieve this specific effect. We also talked a bit about AnimateColor in the video Color My World , although that show was more about comparing RGB and HSB colorspace interpolation, and this show is specifically about using the AnimateColor effect. And yes, this is the last show where I talk about color for a while. I promise. Here's the video: Here is the demo application: And here is the source code . Finally,