flash on 2012-9-14
♥0 |
Line 21 |
Modified 2012-09-14 20:25:52 |
MIT License
archived:2017-03-20 07:39:36
ActionScript3 source code
/**
* Copyright divillysausages ( http://wonderfl.net/user/divillysausages )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/vppF
*/
package {
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
// display textfield for debug
var t:TextField = new TextField;
t.autoSize = TextFieldAutoSize.LEFT;
t.x = t.y = 10.0;
t.border = true;
this.addChild( t );
// get our two dates
var christmas:Date = new Date( 2012, 11, 25 );
var now:Date = new Date;
t.appendText( "christmas: " + christmas + "\n" );
t.appendText( "now: " + now + "\n" );
// get the diff (in millis)
var diff:Number = christmas.time - now.time;
// how much is a day (in millis)
var day:Number = 1000 * 60 * 60 * 24;
// how many days til christmas?
t.appendText( "There are " + int( diff / day ) + " days until christmas" );
}
}
}