Jump to content
Search Community

halilc.1992

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by halilc.1992

  1. Hello everyone :)

     

    I wonder something about TweenMax, onComplete function.

     

    Normally when i use onComplete function its working just perfect but when i try to send a value like a movieclip, onComplete function starting with TweenMax.

     

     

    Here is my code : 

    
    import flash.events.MouseEvent;
    import com.greensock.*;
    import com.greensock.easing.*;
    
    for(var i:int= 0;i<5;i++)
    {
    	this["k"+i.toString()].buttonMode = true;
    	this["k"+i.toString()].addEventListener(MouseEvent.CLICK, sendMyMC);
    }
    
    
    function sendMyMC(e:MouseEvent)
    {
    	TweenMax.to(e.currentTarget,1,{x:400,ease:Back.easeOut,onComplete:KillMC(e.currentTarget.name)});	
    }
    
    function KillMC(name:String)
    {
    	removeChild(this[mc]);
    }
    
    

    In this code I want tween first then removeChild but it just remove my mc on stage and i cant see that Tween :/

  2. 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.

     

  3. Hello everyone,

    Im new here and got a probably a noobie question but can't handle it myself so here is it;

    import com.greensock.*;
    import com.greensock.easing.*;
    import flash.events.MouseEvent;
    
    
    var mc:myMC = new myMC();
    addChild(mc);
    
    mc.x = -200;
    mc.y = stage.stageHeight/2;
    
    var tl:TimelineMax = new TimelineMax({paused:true,yoyo:true});
    tl.append(TweenMax.to(mc,2,{x:stage.stageWidth+200,onComplete:geriSar}));
    function geriSar()
    {
    	tl.reversed = ! tl.reversed;
    	tl.resume();
    }
    function Basla()
    {
    	tl.play();
    }
    
    baslat.addEventListener(MouseEvent.CLICK, animasyonBaslat);
    function animasyonBaslat(e:MouseEvent)
    {
    	Basla();
    }
    durdur.addEventListener(MouseEvent.CLICK, animasyonDurdur);
    function animasyonDurdur(e:MouseEvent)
    {
    	tl.pause();
    }
    yeniden.addEventListener(MouseEvent.CLICK, animasyonYenidenBaslat);
    function animasyonYenidenBaslat(e:MouseEvent)
    {
    	tl.restart();
    } 

     I'm having trouble with this last MouseEvent. tl.restart doesnt work there and i don't get it why ? 

    Thx for advise.

     

    Also i check other post's about this but didn't see soo :)

×
×
  • Create New...