简体   繁体   English

Actionscript Flex getTimer() 最大值

[英]Actionscript Flex getTimer() maximum

Documentation on the flex getTimer() method states: flex getTimer() 方法的文档说明:

int - The number of milliseconds since the runtime was initialized (while processing ActionScript 2.0), or since the virtual machine started (while processing ActionScript 3.0). int - 自运行时初始化(处理 ActionScript 2.0 时)或自虚拟机启动(处理 ActionScript 3.0 时)以来的毫秒数。 If the runtime starts playing one SWF file, and another SWF file is loaded later, the return value is relative to when the first SWF file was loaded.如果运行时开始播放一个 SWF 文件,然后加载另一个 SWF 文件,则返回值与加载第一个 SWF 文件的时间相关。

The maximum value for an int is: 2,147,483,647 which is a bit less than 25 days. int 的最大值为:2,147,483,647,略小于 25 天。 If someone were to leave the flash application running for an extended period of time, does anyone know what happens when this method reaches the maximum value for int?如果有人要让 flash 应用程序长时间运行,有谁知道当这种方法达到 int 的最大值时会发生什么? Does it reset to zero?它会重置为零吗?

I don't know the answer for sure, but I would assume the number would roll over.我不确定答案,但我认为这个数字会翻转。 However, if you're concerned about the roll over, you might want to look at the Timer class, or just use a good ol' timestamp with new Date().getTime() and then doing a comparison between the times.但是,如果您担心翻转,您可能需要查看Timer class,或者只是使用带有new Date().getTime()的良好时间戳,然后在时间之间进行比较。

When int reaches it maximum value 2147483647 and on adding 1 , it should resets to its maximum -ve value -2147483648 and it's iterative in nature, so function should not failsint达到最大值2147483647并添加1时,它应该重置为其最大值 -ve 值-2147483648并且它本质上是迭代的,因此 function 不应该失败

EDIT Code sample is added添加了编辑代码示例

private function intcheck():void
{
    var a:int = 2147483647;
    var b:int = 1;
    var c:int = a+b;

    Alert.show(c.toString());
}

Hopes that helps希望有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM