Jump to content
Search Community

SPotaszn

Members
  • Posts

    3
  • Joined

  • Last visited

SPotaszn's Achievements

0

Reputation

  1. Jack, Thank you for this handy function! Openglpwr, the point of the functions that Jack provided is that they ensure exact timing as defined on the Flash IDE timeline instead of relying on numbers passed into greensock Tween constructors - "3" in the fromTo example you provided. To get fromTo functionality and still preserve the nice timing you've set up in the Flash IDE you'd have to modify Jack's function a little bit: public static function labelTweenDuration( mc:MovieClip, startLabel:String, endLabel:String, fps:Number=Nan ): Number { var labels:Array = mc.currentLabels; if (isNaN(fps)) fps = (mc.stage != null) ? mc.stage.frameRate : 30; var startFrame:int; var endFrame:int; //find the frame numbers of the labels we're tweening between var i:int = labels.length; while( --i > -1 ) { if( labels[i].name == startLabel ) startFrame = labels[ i ].frame; if( labels[i].name == endLabel ) endFrame = labels[ i ].frame; } return Math.abs(endFrame - startFrame - 1) / fps; } The main difference is that we're now calculating the number of frames between the startLabel and endLabel, not the currentFrame and endLabel. Similarly, we have to make a tiny tweak to the createLabelTween to take in a second label parameter as follows: public static function createLabelTween( mc:MovieClip, startLabel:String, endLabel:String, fps:Number = NaN ): TweenLite { return TweenMax.fromTo( mc, labelTweenDuration( mc, startLabel, endLabel, fps ), { frameLabel:startLabel }, { frameLabel:endLabel, ease:Linear.easeNone }); } To wrap things up, with these two functions, openglpwr's Tween changes from TweenMax.fromTo(MC_Anim, 3, {frameLabel:"move_start"}, {frameLabel:"move_end",ease:Linear.easeNone}); to createLabelTween( MC_Anim, move_start, move_end ); and best of all, it is now guaranteed to preserve the timing that was defined in the Flash IDE, not the possibly arbitrary value of 3 seconds.
  2. Here's a boiled-down version of my real-world example: I'm implementing a graph creation & visualization program. When a node is added to the graph, all of the edges draw themselves and then undraw themselves. Whenever a node is rolled over, all incident edges of the node draw themselves and then undraw themselves. The drawing and undrawing of edges is done through tweens. So I have two places where I want to tween alphas, size, position, etc. of edges: on addition of new nodes and on rollovers of existing nodes. Ideally, I'd like the node-addition tweens to supersede the node-rollover tweens. Something like, if a rollover tween starts, and it sees that there's already an addition tween going on, stop execution. However, upon rethinking this issue, I think it's best to leave this check outside the tween level, as in, check if there node-addition tweens going on before even creating node-rollover tweens. Thanks for your response and helping me see another possible and better solution!
  3. Hi, is there anyway to specify that a Tween should not be overwritten? Let's say that I am tweening a single property in multiple places, and in some of those places I want to use OverwriteManager.ALL_IMMEDIATE. However, in other places I want to specify explicitly that tweens do not get overwritten (even by tweens using whose overwrite propery has been set to ALL_IMMEDIATE). Is there a simple way to do this? Thanks!
×
×
  • Create New...