0
   package 
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.TimerEvent;

public class MasterContainer extends MovieClip
{
    public var playTimer:Timer = new Timer(1000,16);


    public function MasterContainer()
    {
        // constructor code
        t1.setSoundName("drum.mp3");
        t2.setSoundName("pluck.mp3");
        t3.setSoundName("drum.mp3");
        t4.setSoundName("drum.mp3");
        t5.setSoundName("drum.mp3");
        t6.setSoundName("drum.mp3");
        t7.setSoundName("drum.mp3");
        t8.setSoundName("drum.mp3");

        masterPlay.addEventListener(flash.events.MouseEvent.CLICK, handleMasterPlay);
        playTimer.addEventListener(TimerEvent.TIMER, onTick);
    }

    public function onTick(event:TimerEvent):void 
    {
        t1.playSound();
        t2.playSound();
        t3.playSound();
        t4.playSound();
        t5.playSound();
        t6.playSound();
        t7.playSound();
        t8.playSound();
    }

    private function handleMasterPlay(e:MouseEvent):void
    {

        trace('bla');

    }


}
}

这是我班的切碎版本。我得到的错误是:C:\Users\Mark\Documents\Creative Multimedia\semester 5\Action Script\project\MasterContainer.as, Line 9 1046: Type was not found or is not a compile-time constant: Timer.

C:\Users\Mark\Documents\Creative Multimedia\semester 5\Action Script\project\MasterContainer.as,第 9 行 1180:调用可能未定义的方法 Timer。

C:\Users\Mark\Documents\Creative Multimedia\semester 5\Action Script\project\MasterContainer.as,第 9 行 1180:调用可能未定义的方法 Timer。

我不明白这个错误任何帮助将不胜感激。

4

2 回答 2

2
import flash.utils.Timer;

你错过了吗?

于 2012-11-19T12:19:51.550 回答
1

所有错误都表明找不到 Timer 类 - 检查您的导入语句,它应该包含以下内容:import flash.utils.Timer;

于 2012-11-19T12:20:01.217 回答