Wednesday, February 2, 2011

Plugins

When I was learning scripting in the secondary school time, I liked to write everything from scratch, and I kind of discriminate people who copies scripts from the others. However from time to time I started to understand the difference between learning and production.

While learning, what's important is the process, but when involved in production, what's important is the speed and the outcome.

Thus, most of the programming masters in the industry are not using 100% genuine codes, except when they are writing codes for security. Script libraries such as JQuery are widely used as a "shortcut" to make things done faster. Followings are the coding plug-ins that I used throughout the production of the website, in both PHP and Actionscript:


1. PHP MySQL wrapper:
MySQL requests are used very frequently when writing PHP codes, that means you would need to type the same thing over and over again in every PHP files. To make it easier, faster and less complicated, it's best to write a class that handles all the database connections.. PHP MySQL Wrapper written by ricocheting is what I've found very useful.
http://www.ricocheting.com/code/php/mysql-database-class-wrapper


2. TweenMax
TweenMax is a plug-in that shorten a lot of codes for animation. For instance, if you want to move a box from 0 to 100 in 25 frames, you need to write the following codes (hard-coding):
function move():void {
addEventListener(Event.ENTER_FRAME, step);
}

function step(e:Event):void {
      x+=4;
      if( x >= 100 ) {
            x = 100;
            removeEventListener(Event.ENTER_FRAME, step);
      }
}

in TweenMax, you just need to write this line:
TweenMax.to(this, 1, {x:100});
and everything is done for you!! you can even assign easing function to make it bounce, going back or appearing elastic.
http://www.greensock.com/tweenmax/


3. AES
AES is a cryptography method used in military force. In Flash-PHP integration, it's used to prevent hacking. In the contest part, I've implemented AES so that people could not simply hack the contest results with SQL-injection method.
http://www.lostinactionscript.com/blog/index.php/2009/11/29/aes-cryptography-for-actionscript-php/

No comments:

Post a Comment