Jump to content
Search Community

yukamui

Members
  • Posts

    10
  • Joined

  • Last visited

yukamui's Achievements

0

Reputation

  1. currentTime ofcourse!! That works perfect, thank you very much again for your help! By the way I visited http://www.snorkl.tv it's full of cool stuff will check it often.
  2. Once again you are my saviour Carl! Thankyou! I could get it to work with the shiftChildren(), but to be honest I am not completely sure how Could you please see my code and tell me how I am supposed to calculate the ignoreBeforeTime parameter? import com.greensock.*; var tl:TimelineMax = new TimelineMax; tl.append(TweenMax.to(mc2,5,{y:String(-mc2.height)})); tl.append(TweenMax.to(mc1,1000,{onInit:changeDuration,x:mc2.x-mc2.width})); tl.append(TweenMax.to(mc2,2,{y:String(-mc2.height)})); tl.append(TweenMax.to(mc2,8,{y:String(mc2.height)})); tl.append(TweenMax.to(mc1,1000,{onInit:changeDuration,x:String(-mc2.width),tint:0xff0000})); tl.append(TweenMax.to(mc2,2,{y:String(-mc2.height),tint:0xff0000})); function changeDuration(){ var tw:TweenMax=tl.getActive(false,true,false)[0]; var outdatedDuration:Number=tw.duration; var updatedDuration:Number=0.1; var ignore:Number =50// I can't figure this var out, I tried (tl.duration-outdatedDuration+updatedDuration) but it does not work for very high durations,oddly 50 does... tw.duration=updatedDuration; tl.shiftChildren(updatedDuration-outdatedDuration,false,ignore); }
  3. Hello, I know this thread has been dead for 2 years but I think that all of what has been said on it is relevant for my question. I have a Timeline and I have dynamically changed the duration of a TweenMax in it, this works great for the tween, but the Timeline does not seem to adjust to the new duration. I even tried using the cacheIsDirty with no success... Anyone can shed light on this? Below an example of my problem: import com.greensock.*; var tl:TimelineMax = new TimelineMax; tl.append(TweenMax.to(mc1,10,{onInit:changeDuration,x:mc2.x-mc2.width})); //The initial duration of this tween is 10, but is modified by change duration to 1. tl.append(TweenMax.to(mc2,1,{y:mc2.y-mc2.height})); //I expect this tween to start as soon as mc1 has completed its new duration but it takes the older 10 second duration for it to start. function changeDuration(){ var tw:TweenMax=tl.getActive(false,true,false)[0]; tw.duration=1 tw.cacheIsDirty=true;//I tried setting the cacheIsDirty to true, but it does not seem to do anything. tl.cacheIsDirty=true; }
  4. Hello Janis! I think the easiest way to achive that is by using the repeat and yoyo parameters. First make sure that the registration point of the movie clip is in the center then you use this line. When you set the repeat parameter to 1, you make tweenmax play 2 times the same line, by setting theyoyo parameter to true you tell TweenMax to reverse every new playback made by the repeat. TweenMax.to(mc,0.5,{scaleX:1.5,scaleY:1.5,repeat:1,yoyo:true}); If you haven't already, check Getting Started Tweening , once you get a hang of it you can skim through the documentation to check all the wanders that TweenMax have to offer! Hope that helps!
  5. Great!!! That should do the trick! Thanks for pointing me out the problem, using a String is a great solution. I changed the code earlier but was stuck with the same problem,but by applying the String it was solved! The problem with the quickly change of direction was made by the updateTo() function, sending true as a parameter would reset the duration making it skip, just changing that to false made it run smoothly... thanks again you have been of great help. Finally what I got was: import com.greensock.TweenMax; import com.greensock.TimelineMax; import com.greensock.*; import flash.display.MovieClip; var tl:TimelineMax= new TimelineMax; tl.insert(TweenMax.to(mc1,1,{x:mc2.x}),tl.duration); tl.insert(TweenMax.to(mc2,1,{x:mc2.x+mc2.width}),tl.duration); tl.insert( TweenMax.to(mc1,1,{x:mc2.x,onStart:resetSpecialTween,onStartParams:[tl,mc2]}),tl.duration); tl.insert(TweenMax.to(mc2,1,{x:String(mc2.width)}),tl.duration); //Here I applied what you suggested. tl.insert( TweenMax.to(mc1,1,{x:mc2.x,onStart:resetSpecialTween,onStartParams:[tl,mc2]}),tl.duration); //I even repeated the lines several times without problems. tl.insert(TweenMax.to(mc2,1,{x:String(mc2.width)}),tl.duration); tl.insert( TweenMax.to(mc1,1,{x:mc2.x,onStart:resetSpecialTween,onStartParams:[tl,mc2]}),tl.duration); tl.insert(TweenMax.to(mc2,1,{x:String(mc2.width)}),tl.duration); //he he, kind of looks like a worm huh? function resetSpecialTween(tl:TimelineMax,mc:MovieClip){ //I was sending an mc as a parameter because I thought I might need to reset mc1.... but didn't do it. var aux:TweenMax = tl.getActive(false,true,false)[0]; aux.updateTo({x:mc.x},false);//If this parameter is true, then you should see the quickly change of direction that you told me. }
  6. No, thank you for all the help you are giving me. I hope I am not getting too abusive with so many questions but I have this new situation if you don't mind looking at it. I managed to use the getActive() to avoid the creation of the variable, using the one that tweenlinemax creates, and everything works fine.... but when I try to use it twice, the second time it does not update the values... I tried to explain it on the trace statements... If you have any thoughts on this, I would love to read them. import com.greensock.TweenMax; import com.greensock.TimelineMax; import com.greensock.*; var tl:TimelineMax= new TimelineMax; tl.insert(TweenMax.to(mc1,1,{x:mc2.x}),tl.duration); //Moves the mc1 to the mc2 position. tl.insert(TweenMax.to(mc2,1,{x:mc2.x+mc2.width}),tl.duration); //The mc2 moves its width to the right. tl.insert( TweenMax.to(mc1,1,{x:mc2.x,onStart:resetSpecialTween,onStartParams:[tl.getActive()[0]]}),tl.duration); // add the special tween, which now perfectly follows to the new x of Mc2 tl.insert(TweenMax.to(mc2,1,{x:mc2.x+mc2.width,onStart:resetSpecialTween,onStartParams:[tl.getActive()[0]]}),tl.duration); //Here I got the new problem, I thought that here I would reset the values again... but that does not happen. tl.insert( TweenMax.to(mc1,1,{x:mc2.x,onStart:resetSpecialTween,onStartParams:[tl.getActive()[0]]}),tl.duration); // add the special tween So when I move the mc1 again to follow mc2, it goes back to the later position. //every time specialTween starts it will get the current value of mc2.x function resetSpecialTween(specialTween:TweenMax){ specialTween.updateTo({x:mc2.x},true); trace(mc2.x) //This function is called 3 times, everytime this trace gives the same position. }
  7. I was checking the documentation and found the following: setDestination(property:String, value:Boolean, adjustStartValues:* = true):void Adjusts a destination value on the fly, optionally adjusting the start values so that it appears to redirect seamlessly without skipping/jerking (this method has been deprecated in favor of updateTo()). That's why I tought it was the other way arround... I tryed your solution with the updateTo() method and it worked as fine. Now I am trying to use the getActive(); in an atempt not to have to define the variable of the specialTweens... but have not been succesful on that yet. Thank you again for following this thread. //create a tween with an onStart callback var specialTween:TweenMax = TweenMax.to(mc1,1,{x:mc2.x, onStart:resetSpecialTween}); var tl:TimelineMax= new TimelineMax; tl.append(TweenMax.to(mc1,1,{x:mc2.x})); tl.append(TweenMax.to(mc2,1,{x:mc2.x+mc2.width})); tl.append(specialTween); // add the special tween //every time specialTween starts it will get the current value of mc2.x function resetSpecialTween(){ trace("init special gps app | mc2.x = " + mc2.x); specialTween.updateTo({x:mc2.x},false); // specialTween.setDestination("x", mc2.x); }
  8. Thank you for your fast reply Carl! You have helped me a lot with your great explanation. Your solution is great and it have pointed me in the direction of the .updateTo(); and the DynamicPropsPlugin; So before applying it I will study the .updateTo(); I am not a club member yet, so I won't be able to try the DynamicPropsPlugin, but if a Member have this situation he might try it. Tonight when I get home I will apply what you have taught me here, thanks again for sharing your knowledge, people like you rock!
  9. Hello everyone, thanks for checking this. My English is not very good but I will try my best to explain my problem. I want to make a mc move in reaction to another, but when I try to use the x position of a mc that was moved earlier in the timeline its position has not changed, I have even traced the position with the addCallback function and it gives me the same position at the start and at the end of the timeline. Do you know what am I doing wrong? Or any way to achive this? Thankyou very much! var tl:TimelineMax= new TimelineMax; tl.addCallback(trace,tl.duration,['mc2.x='+mc2.x]); //The X of mc2 is the same here than at the end of the Timeline. tl.append(TweenMax.to(mc1,1,{x:mc2.x})); tl.append(TweenMax.to(mc2,1,{x:mc2.x+mc2.width})); //Eventough I have moved its position here. tl.append(TweenMax.to(mc1,1,{x:mc2.x})); tl.addCallback(trace,tl.duration,['mc2.x='+mc2.x]); //The X of mc2 is the same here than at the start of the Timeline.
×
×
  • Create New...