Posts Tagged ‘static function’

Leading Zero Static function for digital clock

If you’ve ever created a digital timer or clock then you probably used something like this function. It adds a leading zero if the number is only one digit long. This means that if the minute value is ‘6′ then it will return ‘06′. eg. 12:06:43
 
class com.sitedaniel.utils.StringUtil
{
public function StringUtil(){}
/**
* leadingZero
* Adds a zero [...]

AS2.0 DesignTool

Following up on an earlier post, here is the AS2.0 version of the dragToPosition X & Y coordinate tracer.

class com.sitedaniel.utils.Design
{
public static function dragToPosition(mc:MovieClip):Void
{
mc.onPress = function():Void
{
startDrag(this, false);
}
mc.onRelease = function():Void
{
this.stopDrag();
trace(this._x + ‘, ‘ + this._y);
}
}
}