Please help play/pause toggle button :( 2days no sleep
yes I currently started getting into webdesign and downloaded adobe flash trial as well as dreamweaver trial.
I am very lost on how to add the toggle button. I have tried various codes and watched 2hrs+ youtube tutorials
this is the code I am using.
import flash.media.SoundChannel;
import flash.events.MouseEvent;
import flash.events.Event;
var isplaying:Boolean = true;
var lastposition:Number; - 0;
var mysound:music = new music (ASAP.mp3)
var soundchannel:SoundChannel = SoundChannel();
soundchannel = mysound.play(0,0);
soundchannel.addEventListener(Event.SOUND_COMPLETE,
onPlaybackComplete1);
function onPlaybackComplete1(event:Event):void
{
lastposition = 0;
soundchannel.stop();
BTNplay.btn_pause.invisible = false;
trace("finished");
isPlaying=false;
}
BTNplay.addEventListener(MouseEvent.CLICK, playsound);
function playsound(event:MouseEvent):void
{
if (! isPlaying)
{
soundchannel = mysound.play(lastposition,0);
BTNplay.btn_pause.visible = true;
}
else
{
lastposition = soundchannel.position;
soundchannel.stop();
BTNpause.btn_pause .visible = false;
trace(lastposition.toFixed(0), mysound.lenght.toFixed
(0));
isPlaying = false;
}
soundchannel.addEvenListener(Event.SOUND_COMPLETE,
onPlaybackComplete);
function onPlaybackComplete(event:event):void
{
lastposition = 0;
soundchannel.stop();
BTNpause.btn_pause.visible = false;
trace("finished");
isPlaying=false
}
}
I ADDED THIS.
BTNplay.onRelease = function playsound(event:MouseEvent):void {
ns.pause(false);
BTNplay._visible = false;
BTNpause._visible = true;
};
BTNpause.onRelease = function playsound(event:MouseEvent):void {
ns.pause(true);
BTNplay._visible = true;
BTNpause._visible = false;
};
PLEASE HELP ![]()
