be doing a workshop-style presentation Tuesday on getting started with Flight. Hope to see you there!
I am working with Tyler on Stealth, our high-performance component framework. After reading this article on performance by Arno Gourdol of Adobe I began wondering if we should leave behind our Flash roots of motion and timeline design by defaulting framerate to 0 in our Stealth-based applications.
Framerate makes great sense when doing games or timeline based animations, but in applications do we need it? We can update the screen on mouse moves, roll overs, etc. with the MouseEvent.updateAfterEvent instance method. And for transitions and tweening the class could use a Timer for the duration of the animation and again call Timer.updateAfterEvent. Then the screen would only refresh when it needs to. Performance would be greatly increased. Seems like it makes sense. Would this be something to add to Flex? Would it give us the performance we need/want for mobile applications and more responsive desktop applications?
Any foreseeable drawbacks? What do you think?
Update: I did some testing and it seems that the Timer class is directly influenced by the frameRate. With a frame rate of 0 a timer which should fire immediately (set to 0ms) doesn’t fire for 20 seconds! With the frame rate a 0.1 it happens at about 2 seconds, a frame rate of 1 is about 145 ms and a frame rate of anything over 4 seems to be around the same (10ms – 30ms probably depending on what the OS is currently doing).
MouseEvent updating and such happen as they should however, so as long as you start of with a frame rate of 4 so that the app can initialize visually, you could drop it down to 0 until a tween is needed and then bump it up to 4 for the duration of the tween. The rest of the visual changes can respond to mouse events (resize, click, rollover, etc). Or leaving it at 4 frames a second probably isn’t too bad on CPU, either way, you’d have to call updateAfterEvent when needed.
Hooray for the Flex team! They’re coding to interfaces. I’ve been looking through the source of recent Flex 4 code and I have to say, I’m getting excited to use this stuff. Here are a few of the things I’ve found with just a few minutes of going through their code:
IDeferredContentOwner – The current version of Flex has something like this, but much more complex. This interface makes sense, and simply allows the deferred creation of its children when they are needed (such as a ViewStack in the current Flex). Just a couple of properties and it allows the component to figure out how to do it.
IViewport – This allows any component to have scrolling. What a step forward from the current monster called Container which we probably use more than any other component for layouts (e.g. Canvas, HBox, VBox).
IGraphicElement – This interface is pretty sweet. It allows 1) objects to be drawn on the same DisplayObject (e.g. several Rects could all be drawn on one Shape) and 2) it allows non-DisplayObjects to be used as children of Group by providing their own DisplayObject. I can think of some pretty fun things to do with that as far as custom components/functionality is concerned. :) Maybe I’ll join the OpenFlux initiative and talk more with Ryan Campbell and Ben Stucki about this one.
There’s some good things cooking in the Adobe kitchen. I’ll write about more as I discover it.