Just for the record and myself (I should read all the documentation, also the long sentences
… Make sure you always check hitTestPoint() against global coordinates of some point.
// we are somewhere deep in myObject.myObject2.myInnerObject
var point:Point;
var someMovingObject:DisplayObject;
var hitShape:DisplayObject;
point = localToGlobal(new Point(someMovingObject.x, someMovingObject.y));
point = someMovingObject.localToGlobal(new Point());
// both give us same results,
// 2nd method is faster in loops while it can use predefined zero point
hitShape.hitTestPoint(point.x, point.y, true);
Even hitShape object is not directly on a stage (but on myInnerObject), you have to use global points for testing hits.

While some free time today, I have been playing on guiding script, than suddenly I got an idea, I can create some eye-catching thing with it and voilà, here is little thingy, can be used for screensaver etc… Have a nice Friday
Read the rest of this entry »
GeometryMath.isLine() static function tests 3 Points and returns true if these points are in line. Optional 4th parameter defines if you require point2 to be in the middle between 1 and 3. Function is not based on vector algorithm, but on triangle equation. This simple function was developed in order to optimize number of points necessary to draw some paths. To draw a line, you do not need all the points, you can omit all the middle points that are on the same line and the result looks the same – optimizes performance or storage.
Read the rest of this entry »

If you need to resize an image on client side, I mean real bitmapData resize (not just showing scaled), feel free to use ImageResizer class. This class takes bitmapData of source image, new width and height and resize method (defined by ResizeMath class), and returns new bitmapData of resized image.
Update: It seems that bitmapData.draw() method uses bilinear algorithm when scaling via Matrix. Bilinear algorithm gives you fine results when downscaling no more than 2 times (400px -> 200px). So, I added bilinearIterative() method into ImageResizer class that creates resized bitmapData by multiple steps achieving much smoother results!
Read the rest of this entry »