Archive for the ‘flare’ Category

Tracking mouse movement in Flash Player

June 8, 2009

In a recent prototyping project, I attempted to simulate “shake” gestures in a desktop AIR application, i.e., using mouse cursor to simulate a hand grabbing some object on the screen…

Anyhow. I found out that Flash Player can send out the mouseMove event must faster than it can update the screen. In the case you want to keep track of the simulated gestural motion, you would want to track the mouse cursor position on the stage, instead of the display object the mouse cursor is dragging. This is because when you drag the object to the point Flash Player cannot keep up with, the redaw will then not necessarily reflect the real positional changes of it in between the frames.

Take a look here. Right click to for the code. Also note that when directly register Application.application as the currentTarget we seem to get smoother tracking than if we registered the display object, like so:

mButton.addEventListener(MouseEvent.MOUSE_MOVE, mButton_handleMouseMove);/** you got more stripped out points than if you do this:

addEventListener(MouseEvent.MOUSE_MOVE, mButton_handleMouseMove);// this is btter.*/


Install flare as ActionScript project

March 27, 2009

1. You will need to include “framework.swc” from the Flex SDK in order for it to compile.

In my computer, the framework.swc is at

“C:\Program Files\Adobe\Flex Builder 3\sdks\3.3.0\frameworks\libs”

2. In “ActionScript Build Path”->”Source path”, you would need both folders under “flare” folder. One is “src” (where all the  flare classes reside”; the other is “lib” which is namespaced “com.adobe.serialization.json”.

3. This one just keeps puzzling me. Please let me know if I am missing anything obvious. Flex throws the following error at the compile time,  for this signature

internal function doEnd(evtType:String=TransitionEvent.END):void in flare.animate.Transition:

"Type 1047: Parameter initializer unknown or is not a compile-time constant."

What I did to fix it was I had to change it to:

internal function doEnd(evtType:String=”end”):void