Share Posted August 26, 2015 Hello Everyone, Me again I wonder something about TimelineMax. Can we append sounds inside TimelineMax ? Also i need to use something like SOUND_COMPLETE event here is my code hope u guys can help :/ import com.greensock.*; import com.greensock.easing.*; import flash.events.MouseEvent; import flash.media.Sound; import flash.net.URLRequest; import flash.media.SoundChannel; import flash.events.Event; var tl:TimelineMax = new TimelineMax({yoyo:true,paused:true}); var ses11:Sound = new Sound(new URLRequest("ses/sinem1.mp3")); var ses22:Sound = new Sound(new URLRequest("ses/murat1.mp3")); var ses33:Sound = new Sound(new URLRequest("ses/gokhan1.mp3")); var ses44:Sound = new Sound(new URLRequest("ses/eda1.mp3")); var sC1:SoundChannel = new SoundChannel(); var sC2:SoundChannel = new SoundChannel(); var sC3:SoundChannel = new SoundChannel(); var sC4:SoundChannel = new SoundChannel(); var oynatiliyorMu:Boolean = false; var yazilar:Array = ["Saç canlıdır ama soğan canlı değildir.","Bence saç canlı değildir, soğan canlıdır." ,"Hayır, ikisi de canlıdır.","Saç da soğan da canlı değildir."]; var i:int = 1; for(i;i<5;i++) { this["k"+i.toString()].balon.alpha = 0; } function baslat() { tl.append(TweenMax.to(k1,2,{x:330})); tl.append(TweenMax.to(k3,1,{x:270})); tl.append(TweenMax.to(k2,1,{x:760})); tl.append(TweenMax.to(k4,1,{x:780,onComplete:ses1})); } function ses1() { sC1 = ses11.play(0); k1.balon.yazi.text = yazilar[0]; tl.append(TweenMax.to(k1.balon,1,{alpha:1})); sC1.addEventListener(Event.SOUND_COMPLETE, ses2); } function ses2(e:Event) { sC1.stop(); sC2 = ses22.play(0); k2.balon.yazi.text = yazilar[1]; tl.append(TweenMax.to(k2.balon,1,{alpha:1})); sC2.addEventListener(Event.SOUND_COMPLETE, ses3); } function ses3(e:Event) { sC2.stop(); sC3 = ses33.play(0); k3.balon.yazi.text = yazilar[2]; tl.append(TweenMax.to(k3.balon,1,{alpha:1})); sC3.addEventListener(Event.SOUND_COMPLETE, ses4); } function ses4(e:Event) { sC3.stop(); sC4 = ses44.play(0); k4.balon.yazi.text = yazilar[3]; tl.append(TweenMax.to(k4.balon,1,{alpha:1})); sC4.addEventListener(Event.SOUND_COMPLETE, aniBitis); } function aniBitis(e:Event) { sC4.stop(); trace("animasyon bitti"); } yeniden.buttonMode = true; yeniden.addEventListener(MouseEvent.CLICK, animasyonYenidenBaslat); function animasyonYenidenBaslat(e:MouseEvent) { tl.gotoAndStop(0); tl.play(); } playPause.buttonMode = true; playPause.addEventListener(MouseEvent.CLICK, animasyonBaslat); function animasyonBaslat(e:MouseEvent) { if(oynatiliyorMu == true) { tl.pause(); oynatiliyorMu = false; playPause.oynat.visible = true; } else { tl.resume(); oynatiliyorMu = true; playPause.oynat.visible = false; } } toggle.buttonMode = true; toggle.addEventListener(MouseEvent.CLICK, toggleTl); function toggleTl(e:MouseEvent) { tl.resume(); } When i use this on the first time, it just process perfectly but when i restart it with <yeniden>//this is an mc tho sounds and timeline doesnt gone synchronous. Link to comment Share on other sites More sharing options...
Share Posted August 27, 2015 Sorry, there is no support for sound in TimelineMax and we have absolutely no plans to pursue that. The best you can do is add a callback to your timeline that will tell the sound to start playing at a certain point. http://greensock.com/forums/topic/5022-adding-sound-effects-to-a-tweenlite-animation/ Link to comment Share on other sites More sharing options...
Author Share Posted August 27, 2015 Okey then thanks for reply Carl.. Still greensock Rocks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now