all groups > flash actionscript > march 2007 >
You're in the

flash actionscript

group:

tweening syntax question


tweening syntax question stephan.k
3/29/2007 7:57:13 PM
flash actionscript: Dear List

I have a basic syntax question that I realized I'm not quite familiar with in
flash8. It came up when I've tried to create a combobox to allow the user to
chose different types of Tweening and easing from the Tween class.

I created two comboboxes, one with all the Tween values (Regular, Strong,
Elastic...) and one with all the easing values (easeIn, easeOut...)

When I trace the comboFunc variable below it does trace some function, but
once I plug it into the tweenExtended method nothing happens. It seems to
tween everything the same way.

What am I missing here?

any leads appreciated.

Thanks

Stephan



-----------------
var tweenType = [_root.growingTween.selectedItem.data];
var easeType = [_root.growingEase.selectedItem.data];
var comboFunc = [tweenType+easeType];
this.tween = new TweenExtended(this.ring,
["_xscale","_yscale"],eval([tweenType+easeType]), [this.ring._xscale,
this.ring._yscale], [_root.getMinSize(),_root.getMinSize()],
_root.getShrinkSpeed(), true);



Re: tweening syntax question MotionMaker
4/3/2007 12:00:00 AM
Not real clear on your code snippet. But I assume you could store the easing
method name as a label and the tween class as the data. Then use the
selectedItem.data for the Tween class. But you could also look at the attached
code as an alternative example.


switch( tweens.cb.selectedItem.data )
{
case "strong":
tweenEasing = Strong.easeOut;
break;
case "elastic":
tweenEasing = Elastic.easeOut;

break;
.
.
.
}
new Tween(
__tweenMe_mc,
"-y",
tweenEasing,
0,
100,
3,
true );
Re: tweening syntax question stephan.k
4/4/2007 2:16:28 AM
Excellent solution. Works like a charm.

Thank you very much.

AddThis Social Bookmark Button