In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

forked from: 1桁の月や日を0Xの形に

http://www.project-nya.jp/modules/weblog/details.php?blog_id=432
野中先生方式。
Get Adobe Flash player
by ProjectNya 11 Feb 2011

    Talk

    ProjectNya at 11 Feb 2011 12:20
    野中先生方式は、こういうのにも使えます。http://wonderfl.net/c/cmqM

    Tags

    Embed
/**
 * Copyright ProjectNya ( http://wonderfl.net/user/ProjectNya )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/3dDy
 */

// forked from zahir's 1桁の月や日を0Xの形に
package {
    import flash.text.TextField;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            var d:Date = new Date();
            var month:String = o2t( String( d.getMonth() + 1 ) );
            var date:String = o2t(String(d.date));
            var full:String = String(d.fullYear) + month + date;
            (addChild( new TextField() ) as TextField).appendText( full );
        }
        private function o2t( str:String ):String
        {
                return ("0" + str).substr(-2);
        }
    }
}