首页 \ 问答 \ 在使用Timer时遇到问题(Having problem in using Timer)

在使用Timer时遇到问题(Having problem in using Timer)

我在Flex中使用计时器功能

但它给我一个运行时错误。

我的代码如下所示:

import flash.utils.Timer;
public function fnname():void
{
   if(x==150)
    {
     while (y==0)
     {  x ++;
        Timer(100);
     }
    }
}

我得到的错误是:错误#1034:类型强制失败:无法将100转换为flash.utils.Timer。


I am using a timer function in Flex

but it gives me a run time error.

my code looks like this:

import flash.utils.Timer;
public function fnname():void
{
   if(x==150)
    {
     while (y==0)
     {  x ++;
        Timer(100);
     }
    }
}

the error i get is: Error #1034: Type Coercion failed: cannot convert 100 to flash.utils.Timer.


原文:https://stackoverflow.com/questions/1401543
更新时间:2021-11-08 16:11

最满意答案

看起来你应该把每个部分接踵而至:

^([MTWF]|Th)+ \d\d:\d\d([AP]M)? - \d\d:\d\d([AP]M)?$

 |----------| |---------------|   |---------------|
 ^                           ^      ^
 |                           |      part 3: same as part 2
 part 1: match one of these: |
 - "M", "T", "W", or "F"     |
 - "Th"                      |
                             part 2: match two digits, followed by a colon,
                                     followed by another two digits, then
                                     possible either "A" or "P" followed by
                                     "M"

开头的“^”和结尾的“$”是确保该行没有任何其他文本。

如果你只关心匹配的有效时间(而不是任何两位数字的时间),你可以做一些更有趣的事情,例如:

((1?\d|2[0-3]):[0-5]\d|(1[0-2]|\d):[0-5]\d[AP]M)

It looks like you should just put each part one after another:

^([MTWF]|Th)+ \d\d:\d\d([AP]M)? - \d\d:\d\d([AP]M)?$

 |----------| |---------------|   |---------------|
 ^                           ^      ^
 |                           |      part 3: same as part 2
 part 1: match one of these: |
 - "M", "T", "W", or "F"     |
 - "Th"                      |
                             part 2: match two digits, followed by a colon,
                                     followed by another two digits, then
                                     possible either "A" or "P" followed by
                                     "M"

The "^" at the beginning and the "$" at the end are to make sure the line doesn't have any other text.

If you care about only matching valid times (as opposed to any two digits for the hours), you can do something fancier, like this:

((1?\d|2[0-3]):[0-5]\d|(1[0-2]|\d):[0-5]\d[AP]M)

相关问答

更多
  • 只是FYI,你可以使用VB.NET Like-Operator : string text = "x is not the same as X and yz not the same as YZ"; bool contains = LikeOperator.LikeString(text,"*X*YZ*", Microsoft.VisualBasic.CompareMethod.Binary); 如果您想忽略大小写,请使用CompareMethod.Text 。 您需要using Microsoft. ...
  • 您可以使用各种字符串距离度量。 我会推荐Jaro-Winkler 。 与编辑距离不同,比较的结果是以离散单位编辑的,JW会给你一个0-1的分数。 它特别适用于专有名称。 也看看这个漂亮的教程和这个SO问题。 我没有使用过C#,但这里有一些我在网上找到的JW的实现: Impl 1 (如果您查看文件列表,它们也有DOT NET版本) Impl 2 如果你想做一些更复杂的匹配,你可以尝试对公司名称进行一些自定义标准化处理,例如ltd/limited, inc/incorporated, corp/corporat ...
  • m{^/\*.*\*/$} 将匹配/*作为前两个字符和*/作为最后两个字符的行。 m{^/\*.*\*/$} will match lines that have /* as their first two characters and */ as their last two.
  • 根据消息来源 ,这是一个 快速搜索/计数实施,基于Boyer-Moore和horspool之间的混合,并在顶部添加更多的铃声和哨音。 有关更多背景信息,请参阅: http : //effbot.org/zone/stringlib.htm 这篇文章非常值得一读! Per the sources, it's a fast search/count implementation, based on a mix between boyer-moore and horspool, with a few more b ...
  • 看起来你应该把每个部分接踵而至: ^([MTWF]|Th)+ \d\d:\d\d([AP]M)? - \d\d:\d\d([AP]M)?$ |----------| |---------------| |---------------| ^ ^ ^ | | part 3: same as part 2 part 1: match one of these: | - "M ...
  • 匹配"///RT///"和"///RATE///" 。 I don't know it will work every time or not.But I have tried this and it works right now in this string matching. I want to know whether this is ok or not,please give me suggestion. str1 = str1.Insert(0, "///"); str1=str1.Insert ...
  • 在while循环中尝试pattLoc < (int)strlen(patt) 。 当pattLoc == 2 ,循环将停止,因此你要避免将"my"的'\0'与' ' "hello my name is pala" ' ' "hello my name is pala" ,将pattloc设置为0并return false 。 或者更好,使用字符串substr 。 Try pattLoc < (int)strlen(patt) in your while loop. Loop will stop when p ...
  • Lucene的基本设计使用精确的字符串匹配,或使用Analyzer定义等效字符串。 分析器将文本分解为可索引的标记。 在此过程中,它可以整理等效的字符串(例如大写和小写,词干字符串,删除变音符号等)。生成的标记作为字典存储在索引中,并在文档中存储标记的发布列表。 因此,您可以构建和使用Lucene索引,而无需使用字符串匹配算法(如KMP)。 但是, FuzzyQuery和WildCardQuery使用类似的东西,首先搜索匹配的术语,然后使用它们进行完全匹配。 请参阅Robert Muir关于Automato ...
  • 您可以从字符串的结尾开始,然后以伪代码向后返回: char[] str = input.toCharArray() for i = str.length-1 down to 1: if str[i] is lowercase: if toLowerCase(str[i-1]) == str[i] and str[i-1] is uppercase: return i-1 return -1 // means no match is found Java代码: ...
  • .retteb时代seirt xiferp,drawkcab daer uoy fI 认真。 后缀尝试允许您从字符串的开始处进行遍历。 .retteb era seirt xiferp ,drawkcab daer uoy fI Seriously. Suffix tries allow you to traverse from the beginning of a string.

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)