SoundTouch类示例

时间:2014-06-09 05:10:26

标签: actionscript-3 flash

我有一些课程,我试图从主swf调用一个类的函数。但是我收到错误1120.这是我的主要内容:

import PlayerClass;

SimplePlayer.play(Sound1);

编辑: 我找到了一个例子,但现在我仍然收到错误。

var source:Sound = new Sound1();
var output:Sound = new Sound();

var soundTouch:SoundTouch = new SoundTouch();
soundTouch.pitchSemitones = -6;

var filter:SimpleFilter = new SimpleFilter(sound, soundTouch);
output.addEventListener(SampleDataEvent.SAMPLE_DATA, filter.handleSampleData);

output.play();

这给了我错误:

Sahne 1, Katman ‘Katman 1’, Kare 1, Satır 18, Sütun 44  1120: sound tanımlanmamış özelliğinin erişimi.

当我尝试:

var source:Sound = new Sound1();
var output:Sound = new Sound();

var soundTouch:SoundTouch = new SoundTouch();

output.play();

我收到此错误

ArgumentError: Error #2068: Invalid sound.
    at flash.media::Sound/play()
    at Adsız_08_fla::MainTimeline/frame1()

课程来源位于:https://github.com/also/soundtouch-as3

1 个答案:

答案 0 :(得分:0)

你在每一个案例中所做的就是尝试播放空声:

var output:Sound = new Sound();//this is an empty sound
output.play();//nothing to play so error

您需要按照有关如何在Actionscript 3中播放声音的教程进行操作。我相信Actionscript 3文档有一个完整的示例。我建议从那里开始。