Share Posted April 22, 2012 I'm trying to get TimelineMax to Delay its start for 3 sec and it Doesn't work I used the methods listed in the Documentation, with no success. ill be glad for any help. This is the code I'm useing function stars_OP():void { var timeline_OP:TimelineMax = new TimelineMax(); var clips_OP:Array = getChildrenOf_OP(Object(this).phone_anim_mc.container2_mc); function buildTimeline_OP(e:MouseEvent = null):void { timeline_OP.gotoAndStop(timeline_OP.duration); timeline_OP.clear(); clips_OP = shuffleArray_OP(clips_OP); var a:int = clips_OP.length; while (--a > -1) { var Randsize_OP = Math.floor(Math.random()*(1-0+1))+0; var clip_poz_x_OP = clips_OP[a].x; var clip_poz_y_OP = clips_OP[a].y; var poz_x_Rand_OP = Math.floor(Math.random()*((clip_poz_x_OP+250)-(clip_poz_x_OP)+1))+(clip_poz_x_OP); var poz_y_Rand_OP = Math.floor(Math.random()*((clip_poz_y_OP+20)-(clip_poz_y_OP-5)+1))+(clip_poz_y_OP-5); timeline_OP.append(TweenMax.from(clips_OP[a], 0.5, {alpha:0, scaleX:Randsize_OP, scaleY:Randsize_OP,x:poz_x_Rand_OP, y:poz_y_Rand_OP, blurFilter:{blurX:20, blurY:20, quality:1}, ease:Expo.easeOut}), -0.24); } timeline_OP.gotoAndPlay(0); } buildTimeline_OP(); } I tried this [left]var timeline_OP:TimelineMax = new TimelineMax({Delay:3});[/left] and timeline_OP.Delay = 3; Link to comment Share on other sites More sharing options...
Share Posted April 22, 2012 It's "delay", not "Delay" (do not capitalize it). Link to comment Share on other sites More sharing options...
Author Share Posted April 23, 2012 lower case didn't work, dont know way ended up adding prepend a movie to delay the start timeline_OP.prepend(TweenMax.from(timeline_OP, 4, {delay:4})); not the best Solution Link to comment Share on other sites More sharing options...
Share Posted April 23, 2012 I'd LOVE to see an example FLA that demonstrates the "delay" not working. It worked perfectly in all my tests, so I wonder if there's something else going on in your file. Feel free to post it here so we can publish and see the symptoms for ourselves. Link to comment Share on other sites More sharing options...
Author Share Posted April 29, 2012 Sure,, Take a look Maybe you will find something for-greensock.zip Link to comment Share on other sites More sharing options...
Share Posted April 29, 2012 in the future, please try to simplify your files so that only the code in question is included. you had 3 timelines in there and it wasn't really clear what objects the one in question controlled. That said, you are bypassing the delay by using timeline_OP.gotoAndPlay(0) I think i know where the confusion lies. the delay does not add time to your timeline's duration or add dead space to the beginning, it simply is an amount of time that will transpire before the playhead starts advancing. here is the function that builds a timeline and accurately waits 4 seconds before it begins: function buildTimeline_OP(e:MouseEvent = null):void { var timeline_OP:TimelineMax = new TimelineMax({delay:4}); var clips_OP:Array = getChildrenOf_OP(Object(this).phone_anim_mc.container2_mc); clips_OP = shuffleArray_OP(clips_OP); var a:int = clips_OP.length; while (--a > -1) { var Randsize_OP = Math.floor(Math.random()*(1-0+1))+0; var clip_poz_x_OP = clips_OP[a].x; var clip_poz_y_OP = clips_OP[a].y; var poz_x_Rand_OP = Math.floor(Math.random()*((clip_poz_x_OP+250)-(clip_poz_x_OP)+1))+(clip_poz_x_OP); var poz_y_Rand_OP = Math.floor(Math.random()*((clip_poz_y_OP+20)-(clip_poz_y_OP-5)+1))+(clip_poz_y_OP-5); timeline_OP.append(TweenMax.from(clips_OP[a], 0.5, {alpha:0, scaleX:Randsize_OP, scaleY:Randsize_OP,x:poz_x_Rand_OP, y:poz_y_Rand_OP, blurFilter:{blurX:20, blurY:20, quality:1}, ease:Expo.easeOut}), .24); } } also, if you set a delay on a timeline and pause it in the constructor like so: var tl:TimelineMax = new TimelineMax( {delay:4, paused:true} ); if you build your timeline, and then say wait for the user to click something to start playing the timeline you can do tl.play() and the 4 second delay will kick in before the timeline starts progressing. but if you do tl.gotoAndPlay(0) that will bypass the delay entirely so will tl.restart(); hope that clears things up. Link to comment Share on other sites More sharing options...
Author Share Posted April 30, 2012 cool,tnx for the help,, I didnt understand why it's timeline_OP.gotoAndPlay(0) is bypassing the delay, Can you explain a bit more about it. Link to comment Share on other sites More sharing options...
Share Posted April 30, 2012 Because you're telling the timeline to go to its 0 time and play - it wouldn't make sense to force a delay. What if you didn't want the delay and you wanted to play exactly from time:0? See the problem? However, you can use the restart() method which accepts a parameter indicating whether or not the delay should be included. So your code would be: timeline_OP.restart(true); 1 Link to comment Share on other sites More sharing options...
Author Share Posted May 1, 2012 yes i see the Conflict On the one hand You declare that you want a Delay On the other hand you right gotoAndPlay(0) but isn't gotoAndPlay Something that "live's" in movie clip scope and the delay is something that works on a clip as a Regardless of the position of the time line. I understand the technical way to deal with this in the Future just discussing the logic Behind it Link to comment Share on other sites More sharing options...
Share Posted May 1, 2012 but isn't gotoAndPlay Something that "live's" in movie clip scope and the delay is something that works on a clip as a Regardless of the position of the time line. I don't understand your logic here. So are you saying that if I set a delay:3 on a TimelineMax and then do gotoAndPlay(1), it would delay for 3 seconds and then play from time:1? That doesn't seem the least bit intuitive to me, but maybe I'm misunderstanding. Are you saying that the delay would only apply if I gotoAndPlay(0)? If so, it would be impossible for me to ever play from the beginning without the delay? 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