Friday, May 18, 2012

Why Flash is better than Processing when displaying or programming

Display differences between Flash and Processing
In Processing the screen is a bitmap, a grid of pixels where you can draw, similar to the Canvas object in HTML5. Once you draw an ellipse, it becomes pixels. The display has no knowledge of objects. If you want to know if an object was clicked, you have to calculate yourself if the mouse action took place on top of some object in the screen. But you have to keep track yourself of sizes and locations of your objects.


In Flash/ActionScript the display is like a tree. You can add objects to the Stage, and objects inside objects. Each object has x, y, width, height, rotation and alpha properties which can be modified at any time. This makes it very easy to animate objects and also to detect mouse interaction. By default the programmer knows which object in the screen was clicked, rolled over or out, because Flash keeps track of all elements in the screen. If you draw an ellipse, it stays an ellipse. Unless you want to work in a way similar to Processing, in which case you can work with just one bitmap on the Stage and forget about the whole Flash Display Model.

Rotation of objects in Flash is usually also simpler. You can access the .rotation property of any object and change it. By default the center of rotation is the center or corner of each object, but it can be modified. To rotate in Processing you should first translate() the axes, then rotate() them and finally draw your object on the screen.

1 comment:

  1. Hi, Nice Post. PMI’s Project Management Professional (PMP)® credential is the most important industry-recognized certification for project managers. Recently I went for a PMP prep course by the training provider you have mentioned, Instructer was too good and I passed with relative ease. Looking forwards to apply what I learned in PMP classes in my company.

    ReplyDelete