找不到AS3类型:声音

时间:2013-01-09 17:22:34

标签: actionscript-3 flash air

我有一小段AS3代码,它不起作用:(

var snd:Sound = new Sound(new URLRequest("Hit1.wav"));
var channel:SoundChannel = new SoundChannel();
channel= snd.play();

我得到的只是

type was not found or was not a compile-time constant: Sound
type was not found or was not a compile-time constant: SoundChannel

我该如何解决这个问题?

帆布

1 个答案:

答案 0 :(得分:3)

您必须导入类:

import flash.media.Sound;
import flash.media.SoundChannel;

或只是:

import flash.media.*;