dynColorTween MX
v1.01


Download the source file


MovieClip.dynColorTween

Player
    Flash Player 6

Syntax
    myMC.dynColorTween({duration: frames, [ra:n1, [rb:n2, [ga:n3, [gb:n4, [ba:n5, [bb:n6, [aa:n7, [ab:n8,
                        [callback:path, [cbArgs:args]]]]]]]]});

Parameters
    Parameters should be passed in a form of object literal(s) which is called color tween object(s) here.
    Each object may contain the following.

    duration 
        An integer that specifies the number of the frames during which the tween should happen

    ra, rb. ga, gb, ba, bb, aa, ab
        ra is the percentage for the red component (-100 to 100).
        rb is the offset for the red component (-255 to 255).
        ga is the percentage for the green component (-100 to 100).
        gb is the offset for the green component (-255 to 255).
        ba is the percentage for the blue component (-100 to 100).
        bb is the offset for the blue component (-255 to 255).
        aa is the percentage for alpha (-100 to 100).
        ab is the offset for alpha (-255 to 255).
		
		(See 'Color.setTransform' in the ActionScript Dictionary for more info.)

    callback 
        A string of the full path to the function to execute as a callback

    cbArgs
        An object that contains the parameters to pass to the callback function
		
Description
    Method; Tweens the color of a movieclip from the current state to the state 
            which is specified with the passed color tween object. 
            A series of color tweens can be applied with one action by passing multiple color tween objects.

Example
    // Example 1
    buttonMC1.onPress = function () {
        // Decrease the percentage for the red component of the movieclip 'plane'
        // from the current state, which is 100% unless it has been explicitly set otherwise 
        // with setTransform, to 0% during 10 frames, 
        // and then increase it up to 100% during 10 frames.
        _root.plane.dynColorTween({duration:10, ra:0},{duration:10, ra:100});
    }

    //------------------------------------------------------------------------------------------
    // Example 2
    buttonMC2.onPress = function () {
        // Change the color of the movieclip 'square' to red, green, blue, yellow, cyan and magenta,
        // one after another, each with a duration of 5 frames.
        _root.square.dynColorTween({duration:5, rb:255},
                                   {duration:5, rb:0, gb:255},
                                   {duration:5, gb:0, bb:255},
                                   {duration:5, rb:255, gb:255, bb:0},
                                   {duration:5, rb:0, bb:255},
                                   {duration:5, rb:255, gb:0},
                                   {duration:5, gb:255},
                                   {duration:5, rb:0, gb:0, bb:0, callback: this + ".onPress"}
            );
        // callback: this + ".onPress" assigns the function that has called this dynColorTween 
        // to callback, so the tweens will loop forever until reset with the colorReset method.
        // (Look in the Reset button)
    }

          
 


Back to Flash Home

Copyright©2000-2002 STUDIO FIRST RAYS. All rights reserved