Export animation sheet

After reading swf (source swf) in another swf (main swf), the main swf can create a sprite sheet for an animation which sit in a MovieClip in the source swf.

This is a screen of the application that we developed for the purpose.

This is an example that it exported.

This application also assumes that an android project will use our animation framework for an android application. It will export some source code as well.

Read a swf in another swf

Tried to read a swf in an air application because we would like to know a list of linkage IDs in the swf. Unfortunately ActionScript doesn’t seem to support APIs to list linkage IDs. At least we were not able to find the APIs.

Swf File Format Specification Version 10 was very helpful. Especially “APPNDIX A” is filling in gaps of the main part.

Finding linkage IDs is now one of functions that Kakine supports. Kakine is our ActionScript frame work.

DisplayObject.x and y are just for display.

All display object, such as MovieClip, Sprite, Shape, Bitmap and so on, are extended from DisplayObject. DisplayObject has x and y properties which are defined as Number data type. An Adobe document says “The Number data type uses the 64-bit double-precision format as specified by the IEEE Standard for Binary Floating-Point Arithmetic (IEEE-754)”. In simple terms, the type has very very good precision. So DisplayObject.x and DisplayObject.y should have very very good precision. Let’s see what happens. First of all, we’ll check Point class, which has Number data type variables, x and y. Point class is has nothing to do with DisplayObject class.

var pt:Point = new Point();
pt.x = Math.PI;
trace(“pt.x=”,pt.x);

We input circle ratio (pi) into x. We will have a result like the below.

pt.x= 3.141592653589793

Yes, it has much better percision than mine. Well, let’s see what happens to DisplayObject.x. We picked up Shape class, which is extended from DisplayObject. In a similar way, pi is set to its x property.

var shape:Shape = new Shape();
shape.x = Math.PI;
trace(“shape.x=”,shape.x);

In this case, we will have a result like the below unexpectedly.

shape.x= 3.1

Oh, no!
To have an object move with ActionScript like a video game, a new position of a character is often calculated from the last position. As the last position, x and y properties of a DisplayObject are often used. What if those properties have poor precision? In the above example, the difference between pt.x and shape.x is 0.04159265358979303. Although it’s a small number, the error might be accumulated and becomes non-ignorable. For example, let’s assume that a character position is calculated each frame in a 24 FPS application. A second later, the difference should be about 1. A minute later, the difference should be about 60. This means a character might be located at somewhere 60 pixel away from an expected position. Here is a sample application. A red circle (_red) and a green one (_green) are in a same uniform circular motion. A new position of each object is based on its current position. For the red one, DisplayObject.x and y (i.e. _red.x and _red.y) are used as its current position. For the green one, Point.x and y (i.e. _greenPt.x and _greenPt.y) are used.

var p:Point = getDirection();
_red.x += p.x;
_red.y += p.y;
_greenPt.x += p.x;
_greenPt.y += p.y;
_green.x = _greenPt.x;
_green.y = _greenPt.y;


We hope you will see how different it is.

Conclusion: DisplayObject.x and y are only for display. Don’t use these in math if precision is required.

If the world consisted of only circular objects, …

Math of a collision detection is not preventable in some video games. There are a lot of tricks to make it easier, but there are still complicated math in it. In this post, we’ll show you one of the tricks. This trick works only if the world consisted of only circular object. It would work with a little effort when there are some non-circular objects in the game. To make our discussion easier, let’s assume all objects are circular in the game. Trick: Consider the main character a dot and inflate all the other object by the main character’s radius. Then math of collision detection would be much easier.


Although complicated math is still required, we can make something like this easier with this trick.


Now, solve the puzzle!

Did you enjoy my last posts about a 3D puzzle? Have you ever solved a Rubik’s Cube?


Now, you can! Here is instructions after clicking the switch above:
If you have a webcam,

  1. Keep your hand away from your mouse.
  2. Relax by allowing yourself to breathe fully.
  3. Touch your mouse gently and accept using your webcam.
  4. Give total attention to the hand that is controlling the cubes.
  5. It’s time to move your hands in front of your webcam when you feel that your hand starting emanate aura

If you don’t have a webcam or don’t want to use it,

  1. Keep your hand away from your mouse.
  2. Relax by allowing yourself to breathe fully.
  3. Touch your mouse gently.
  4. Give total attention to the hand that is touching your mouse.
  5. It’s time to move your mouse around the cubes when you feel that your hand starting emanate aura

You will solve this puzzle if you focus all your attention on succeeding. Good Luck! No Papervision3D.

Cubes in stereograms

Do you want to see the last posted cubes in a stereograms?. Now, those are in stereograms.


Please see those with parallel eyes. No Papervision3D.

A 3D puzzle is moving.

A 3D puzzle is moving.

ActionScript is often running in better performance than I expected if a complicated logic was implemented. So I am wondering how fast it is if we implemented a 3D logic in a Flash application. No Papervision3D.