import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.text.TextField; var text:TextField = new TextField();
var endTime:Date = new Date(2015,7-1,29,15,30,0);
var timer:Timer = new Timer(1000);
text.autoSize = "left";
this.addChild(text);
timer.addEventListener(TimerEvent.TIMER,onTimer);
timer.start();
function onTimer(e:TimerEvent):void
{
text.text = formateCountdown(endTime,new Date());
}
function formateCountdown(endTime:Date,nowTime:Date):String
{
var total:Number = Math.floor((endTime.getTime() - nowTime.getTime()) / 1000);
if (total > 0) {
var day:Number = Math.floor(total / 86400);
total = total - day * 60 * 60 * 24;
var hours:Number = Math.floor(total / 3600);
total = total - hours * 60 * 60;
var minutes:Number = Math.floor(total / 60);
total = total - minutes * 60;
var seconds:Number = total;
return day.toString()+"天"+hours.toString()+"时"+minutes.toString()+"分"+seconds.toString()+"秒";
}
return "倒计时日期已过...";
}

[ActionScript 3.0] 简单倒计时的更多相关文章

  1. jQuery简单倒计时插件

    一. 效果预览 二. 实现 1. 按照特定的类结构布局. 2. 需要先引入jQuery,再引入此文件. /** * Author: CC11001100 * * 简单倒计时 * * 1. 支持页面内同 ...

  2. ActionScript 3.0入门:Hello World、文件读写、数据存储(SharedObject)、与JS互调

    近期项目中可能要用到Flash存取数据,并与JS互调,所以就看了一下ActionScript 3.0,现把学习结果分享一下,希望对新手有帮助. 目录 ActionScript 3.0简介 Hello ...

  3. [转]ActionScript 3.0入门:Hello World、文件读写、数据存储(SharedObject)、与JS互调

    本文转自:http://www.cnblogs.com/artwl/p/3396330.html 近期项目中可能要用到Flash存取数据,并与JS互调,所以就看了一下ActionScript 3.0, ...

  4. ActionScript 3.0 API 中的 Video 类

    注:这个类在Flash流媒体开发中使用的很频繁,在此记录一下它的使用方法. 包 flash.media 类 public class Video 继承 Video  DisplayObject  Ev ...

  5. [ActionScript 3.0] 正则表达式

    正则表达式: 正则表达式最早是由数学家Stephen Kleene在对自然语言的递增研究成果的基础上,于1956提出来的.具有完整语法的正则表达式,主要使用在字符串的格式的匹配方面上,后来也逐渐应用到 ...

  6. JS高级群的日常!写一个从10到0的倒计时,用console.log打印,不可以用 setInterval!本来说好的研究avalonJS最后演变成了看着大神在那边互相比拼实力。。

      JS高级群的日常!写一个从10到0的倒计时,用console.log打印,不可以用 setInterval!本来说好的研究avalonJS最后演变成了看着大神在那边互相比拼实力..   小森执行一 ...

  7. ActionScript 3.0 for the Lunder Algorithm

    package com.feiruo.Calendar.LunderCalendar { /* *@ClassName: package:com.feiruo.Calendar.LunderCalen ...

  8. [ActionScript 3.0] AS3.0 动态加载显示内容

    可以将下列任何外部显示资源加载到 ActionScript 3.0 应用程序中: 在 ActionScript 3.0 中创作的 SWF 文件 — 此文件可以是 Sprite.MovieClip 或扩 ...

  9. 【转】学习Flex ActionScript 3.0 强烈推荐电子书

    学习Flex ActionScript 3.0 强烈推荐电子书 AdvancED ActionScript 3.0 Animation(<Make things  move>姐妹篇,强烈推 ...

随机推荐

  1. WWW.LoadFromCacheOrDownload

    [WWW.LoadFromCacheOrDownload] static WWWLoadFromCacheOrDownload(string url, int version, uint crc = ...

  2. 如何降低Unity程序的Drawcall

    [如何降低Unity程序的Drawcall] Unity can combine a number of objects at runtime and draws them together with ...

  3. Kafka存储机制(转)

    转自:https://www.cnblogs.com/jun1019/p/6256514.html Kafka存储机制 同一个topic下有多个不同的partition,每个partition为一个目 ...

  4. mysql的my.ini配置文件

    第一步,我们找到mysql安装文件下面的my.ini文件,打开可以看到第一句: # MySQL Server Instance Configuration File Mysql服务实例配置文件 好,咱 ...

  5. 对称二叉树 · symmetric binary tree

    [抄题]: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). ...

  6. ubuntu 14.04 Clion2016.2 安装激活与安装后添加快捷启动方式

    参考链接:http://www.cnblogs.com/conw/p/5938113.html 下载clion for linux : http://www.jetbrains.com/clion/d ...

  7. Openssl crl命令

    一.简介 crl命令用于处里PME或DER格式的CRL文件 二.语法 openssl crl [-inform PEM|DER] [-outform PEM|DER] [-text] [-in fil ...

  8. Oracle Nested table、Record

    1.如何在PL/SQL中创建和使用Nested table;2.如何在PL/SQL中创建和使用Record; 1.如何在PL/SQL中创建和使用Nested table DECLARE /**创建一个 ...

  9. 树状数组 - 2352 Stars

    题目地址: http://poj.org/problem?id=2352 分析: - 题意分析:  有n个星星, 它的左下方(x和y不超过它)的星星的数目就是它的level, 分别计算level 为 ...

  10. Arch Linux 使用markdown

    Arch Linux 使用markdown pandoc 文档格式转换 pygments 代码高亮 markdown-mode.el 配置emacs pandoc 号称文件格式转换的瑞士军刀,这里主要 ...