【发布时间】:2014-04-06 13:46:23
【问题描述】:
所以我正在尝试在 Flash 中创建一个计时器,只是一个基本计时器。我在 Google 上查看了一些教程,发现了一些不错的教程。我遇到的问题是当我尝试在不同的屏幕上创建计时器时。我已经制作了动态文本框myText。当我尝试访问myText 时,它给了我Game Screen, Layer 'AS3', Frame 156, Line 11, Column 2 1120: Access of undefined property myText.
这是我的代码在调用计时器时的样子:
import flash.utils.Timer;
import flash.events.TimerEvent;
var count :Number=60;
var myTimer :Timer=new Timer(1000, count);
myTimer.addEventListener(TimerEvent.TIMER, countdown);
myTimer.start();
function countdown(event:TimerEvent):void
{
myText.text=String((count)-myTimer.currentCount);
}
我已按照教程进行了 T 并不断遇到问题。 Am I creating the text box wrong? Do I need to add the text box to the screen I want it on? Do I need to create a movie clip with the text box in it?我不确定我做错了什么,任何帮助将不胜感激。谢谢!
【问题讨论】:
标签: actionscript-3 flash timer