Plurk paste
1
2
var i:int = 13;
("000" + i).substr(-4, 4); // 0013
Direct link:
https://paste.plurk.com/show/530281