在 flex3/actionscript 中使用超时时出错
好吧,这就是我到目前为止所拥有的 - 但它给了我一个错误,说我在某处缺少分号,但我不知道在哪里。基本上我想要它做的是,当单击按钮时,会生成一个随机数,然后隐藏一张图片,显示一张图片 - 然后暂停后,隐藏该图片并显示另一张图片。
<mx:Button x="220" y="10" label="Shuffle the Cards" fontFamily="Times New Roman" fontSize="18" fontStyle="italic" fontWeight="normal"
click="
var shuffleDeck:Function = function shuffle():void {
var randNum:Number = Math.floor(Math.random()*(4))+1;
pic.visible = false;
shuffle.visible = true;
}
setTimeout(shuffle,100);
shuffle.visible = false;
select.visible = true;
"/>
Ok, this is what I have so far - but it gives me an error saying that I am missing a semicolon somewhere, but I cant figure out where. Basically what I want it to do is when the button is clicked a random number is generated, then one pic is hidden, one is shown - then after a pause, that pic is hidden and a different one is shown.
<mx:Button x="220" y="10" label="Shuffle the Cards" fontFamily="Times New Roman" fontSize="18" fontStyle="italic" fontWeight="normal"
click="
var shuffleDeck:Function = function shuffle():void {
var randNum:Number = Math.floor(Math.random()*(4))+1;
pic.visible = false;
shuffle.visible = true;
}
setTimeout(shuffle,100);
shuffle.visible = false;
select.visible = true;
"/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简短回答
详细回答
以下实际上只是一个语句(恰好包含一个块):
...并且像任何其他语句一样,它必须以分号结尾。
块通常不以分号结尾,因此看起来具有欺骗性,但本例中的块只是语句的最后一部分。
short answer
long answer
The following is really just a single statement (that happens to contain a block):
...and like any other statement, it must end with a semicolon.
Blocks don't normally end with a semicolon, so it's deceptive looking, but the block in this case is just the last part of the statement.