there is a problem with sound.

Aug 08, 2011

Hi,

       This is Ajanthan. M from NIT Services, and i have a question. I have did an animation using adobe flash. And i have written some script to import the audio from library to frame. when i execute it in flash player its working perfectly. but if i publish in articulate i couldn't hear the voice.  i have used the following script to import the voice from library to key frame, and i have used action script 2.0.

var n:Sound;

news_btn.onRelease = function ()

{

       n.attachSound("news");

       n.play();

}

the news is the linkage name for the voice i ve used.

Please help me to overcome this problem.

thank you,

regards

Ajanthan. M

1 Reply
David Burton

Ajanthan,

Because the attachSound actionscript will only work when inserted on the main timeline (_root) the minute you add this to a Presenter project this line of code no longer resides on the main timeline but instead a child level of the Presenter player.
Referencing the sound with this or using the  loadSound() method instead should workaround this issue. See example below:

var audioFile:String = "";

var audio_obj = new Sound(this);
this.audio_obj.stop();

function init(f:String,p:Boolean):Void {
audioFile = f;
this.audio_obj.attachSound(audioFile);
trace("Initializing: "+audioFile);
if(p) doPlay();
}

function doPlay():Void {
if(audioFile.length == 0) return;
trace("Playing: "+audioFile);
this.audio_obj.start(0,1);
}

function doStop():Void {
if(audioFile.length == 0) return;
trace("Stopping: "+audioFile);
this.audio_obj.stop();
}

this.audio_obj.onSoundComplete = function() {
doStop()
}

stop();

This discussion is closed. You can start a new discussion or contact Articulate Support.