Jump to content
Search Community

manor

Members
  • Posts

    7
  • Joined

  • Last visited

manor's Achievements

1

Reputation

  1. Thanks for your help. Yes I know I need to take the plunge and commit to OOP. Have any book recommendations?
  2. I am trying to create three timelines with each pass of the loop. I need to be able to call each timeline at different times. I have it written out the "long" way and it works just fine, I attached a sample of how I am doing it below. I am grouping them together like this because each "button" needs own version of each timeline. I was just trying to shorten the amount of code by looping through it. //button 1 var b1_otl_a:TimelineMax = new TimelineMax({paused:true}); b1_otl_a.insert(TweenMax.from(b1label, .2, {rotation:-15, alpha:0})); var b1_otl_b:TimelineMax = new TimelineMax({paused:true}); b1_otl_b.insert(TweenMax.from(b1, .2, {dropShadowFilter:{color:666666, alpha:1, blurX:12, blurY:12, distance:3}})); var b1_otl_row:TimelineMax = new TimelineMax({paused:true}); b1_otl_row.insert(TweenMax.from(b1label_row, .1, {alpha:0})); //button 2 var b2_otl_a:TimelineMax = new TimelineMax({paused:true}); b2_otl_a.insert(TweenMax.from(b2label, .2, {rotation:-15, alpha:0})); var b2_otl_b:TimelineMax = new TimelineMax({paused:true}); b2_otl_b.insert(TweenMax.from(b2, .2, {dropShadowFilter:{color:666666, alpha:1, blurX:12, blurY:12, distance:3}})); var b2_otl_row:TimelineMax = new TimelineMax({paused:true}); b2_otl_row.insert(TweenMax.from(b2label_row, .1, {alpha:0})); // and 15 more "buttons" after this...
  3. Thanks for the tip. I built the animation in stages and did realize I was scaling it twice. Now I think I might have gone too far in trying to automate timlineMax. I am trying to loop through the same array but this time I need to make three timeslines per entry. This is causing a problem because I can't figure out how to use a variable in the name of a new variable, and maybe it is not possible? The code below is wrong because the variable names are declared twice, which is not allowed. Any suggestions on how I might pull this off? Is there some syntax trick I am missing? var animatedButtonList:Array = new Array("b1","b2","b3","b4","b5","b6","b7","b8","b9","b10","b11","b12","b13","b14","b15","b16","b17"); for (var j:int=0; j var my_names:Array = new Array(); var mylabel = animatedButtonList[j]+"label"; var myrowlabel = animatedButtonList[j]+"label_row"; var my_otla = animatedButtonList[j]+"_otla"; var my_otlb = animatedButtonList[j]+"_otlb"; var my_otlrow = animatedButtonList[j]+"_otl_row"; var my_otla:TimelineMax = new TimelineMax({paused:true}); my_otla.insert(TweenMax.from(this.getChildByName(mylabel), .2, {rotation:-15, alpha:0})); var my_otlb:TimelineMax = new TimelineMax({paused:true}); my_otlb.insert(TweenMax.from(this.getChildByName(animatedButtonList[j]), .2, {dropShadowFilter:{color:666666, alpha:1, blurX:12, blurY:12, distance:3}})); var my_otlrow:TimelineMax = new TimelineMax({paused:true}); my_otlrow.insert(TweenMax.from(this.getChildByName(myrowlabel), .1, {alpha:0})); }
  4. I got this working and I just wanted to share and ask the board if there is a way to improve the code. I am looping through an array to build a timeline. This particular animation takes a series of buttons and moves them to one point and then spreads them out along a line. I now can change one variable and get the spacing just right without having to manually change 17 values by hand while doing the math in my head. Yet another reason to love timelineMax... var animatedButtonList:Array = new Array("b1","b2","b3","b4","b5","b6","b7","b8","b9","b10","b11","b12","b13","b14","b15","b16","b17"); var buttons_tl:TimelineMax = new TimelineMax({paused:true,onComplete:grid_button_clicked_done}); var moveX:int = 30; for (var i:int=0; imoveX = moveX+50; buttons_tl.insert(TweenLite.to(this.getChildByName(animatedButtonList[i]), 1,{x:398, y:570, scaleX:0.33, scaleY:0.33, ease:Expo.easeInOut})); buttons_tl.insert(TweenLite.to(this.getChildByName(animatedButtonList[i]), .5,{x:moveX, y:570, scaleX:0.33, scaleY:0.33, ease:Expo.easeInOut, delay:1})); }
  5. This issue is solved... I needed leave the "()" off the function call: b1.addEventListener(MouseEvent.MOUSE_DOWN, b1_fn); function play_b1():void{ mask_mc.alpha = 1; b1art.alpha = 1; mask_mc.play(); } function b1_fn (Event:MouseEvent):void{ var b1_tl:TimelineMax = new TimelineMax(); b1_tl.insert(TweenMax.to(b1, .5, {x:274.55, y:200, delay:.5, ease:Linear.easeNone, onComplete:play_b1}));
  6. I get the same result adding the onComplete to the TweenMax.to. To clarify I have the timline linked to a MOUSE_DOWN event. I am not sure if that makes a difference, but I included the listener at the top of my code snippet. b1.addEventListener(MouseEvent.MOUSE_DOWN, b1_fn); function play_b1():void{ mask_mc.alpha = 1; b1art.alpha = 1; mask_mc.play(); } function b1_fn (Event:MouseEvent):void{ var b1_tl:TimelineMax = new TimelineMax(); b1_tl.insert(TweenMax.to(b1, .5, {x:274.55, y:200, delay:.5, ease:Linear.easeNone, onComplete:play_b1()}));
  7. When I run the code below the function I call with the onComplete parameter plays at the start of my timeline not on completion. Any ideas? ... function play_b1():void{ mask_mc.alpha = 1; b1art.alpha = 1; mask_mc.play(); } function b1_fn (Event:MouseEvent):void{ var b1_tl:TimelineMax = new TimelineMax({onComplete:play_b1()}); b1_tl.insert(TweenMax.to(b1, .5, {x:274.55, y:200, delay:.5, ease:Linear.easeNone})); ...
×
×
  • Create New...