mouseDOWN after sound has Completed plz help!
Hey there, hope someone could help me out, im sure there is a simple solution to this problem.
This what I would like to happen:
ROLL OVER - the btn plays a sound
MOUSE DOWN - plays the animation
Im trying to get the animation to play only after the sound has been finished. But here is the problem; you roll over the btn and the sound starts, and u click in the middle of the sound playing, is it possible the animation to only start after this sound finshes?
here is the code that im trying but it doenst work:
import flash.media.Sound;
import flash.media.SoundChannel;
var Sound_Timer:Timer = new Timer(1000,1);
var looksLal: that_Layla =new that_Layla();
var looksLal_Channel:SoundChannel;
var looksLal_Transform: SoundTransform=new SoundTransform();
var sndOne:Boolean = true;
var anim:Animation = new Animation ;
var btn:btnObj = new btnObj ;
var clickVar = 0
addChild(btn);
btn.x = 500;
btn.y = 350;
addChild(anim);
anim.x = 0;
anim.y = 0;
btn.addEventListener(MouseEvent.MOUSE_DOWN,btn_click);
function btn_click(e:MouseEvent):void
{
clickVar += 1
if (clickVar == 2)
{
anim.play();
}
}
btn.addEventListener(MouseEvent.MOUSE_OVER,roll_Over);
function roll_Over(e:MouseEvent):void
{
if (sndOne == true)
{
clickVar = 0
sndOne = false;
looksLal_Channel = looksLal.play(0,1);
looksLal_Transform.volume = 1;
looksLal_Channel.soundTransform = looksLal_Transform;
looksLal_Channel.addEventListener(Event.SOUND_COMPLETE, snd_Done);
}
}
function snd_Done(event:Event):void
{
Sound_Timer.addEventListener(TimerEvent.TIMER_COMPLETE,sndPlay);
Sound_Timer.start();
}
function sndPlay(event:Event):void
{
sndOne = true;
clickVar += 1
}
if you can help id rly appriciate it
thx pavel