No announcement yet.

[Solved] Scaleform UI - Tween

  • Filter
  • Time
  • Show
Clear All
new posts

    [Solved] Scaleform UI - Tween


    I'm trying to learn how to build a Scaleform UI for my project.
    I'm testing a lot of things and I didn't find any documentation on how to use the Tween functions for Scaleform.

    here is my test script :

    _global.gfxExtensions = true;
    testtitleMC._yrotation = -45;
    Nothing fancy, my title is well rotated -45° around its axis.

    Then I try to Tween it so it has a "door-like" rotation :

    import gfx.motion.Tween;
    _global.gfxExtensions = true;
    testtitleMC._yrotation = -45;
    tweenTo( 2.0, 'testtitleMC._yrotation = 0',);
    My title is flattened, as I wished, but no motion at all.

    I browsed into the script in the Dev/Src/Flash folder of UDK but it was no help at all.

    Here is the function :

    	 * Tween the properties of a MovieClip specified in the {@code props} object.
    	 * @param duration The duration of the tween in seconds
    	 * @param props A list of properties in the MovieClip to tween
    	 * @param ease An function to use to apply easing to the tween
    	public function tweenTo(duration:Number,props:Object,ease:Function):Void {
    		var startProps:Object = {};
    		for (var n:String in props) {
    			startProps[n] = this[n];
    I tried a lot of different combinations of parameters, nothing worked.

    In the UDK example Gfx HUD/Menu, all the tween functions are different. You can find them in the UTGFxTweenableMoviePlayer.uc file in UTGAME/Classes folder.

     * Create a new tween on a GFxObject.
     * mc: Target GFxObject to tween.
     * duration: Duration of tween.
     * member: A number member of GFxObject to tween (ie. "_z").
     * target: A float that, when reached, triggers the tween stop.
     * tweenClass: The type of tween (EaseOut, EaseIn, Linear).
     * callback: Data which can be used by the class which instaniated the tween to trigger a subsequent event.
    function TweenTo(GFxObject mc, float duration, String member, float target, TweenType NewTweenType, optional String callback = "")
    I'm lost. I can really appreciate some help.

    Thank you.

    The tweenTo and other functions are attached (or extended) to the MovieClip class.

    This means to access them you would use the following :

    1. import and initialise the tween class before any clips requiring access to the functions are created (frame 1 is a good place).

    2. proper syntax :myMovieClip.tweenTo(duration:Number,props:Object,ease:Functio n)


      Thank you for your reply.

      The problem I had was the syntax of the props:Object.

      I downloaded the August QA Flash files from UDN3 / Scalefrom and found my answer.

      It was :

      testtitleMC.tweenTo(0.5, {_yrotation:0}, mx.transitions.easing.Strong.easeOut);

      Now my title move as I wanted.

      I hope they will release some sort of documentation soon.