A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 23 of 23

Thread: How to color the tint of a movieclip using as3

  1. #21
    Junior Member
    Join Date
    May 2008
    Posts
    2

    Question Making a tween work

    If I use this code to colorise my movieclips my tweens (simple motion tween) do not work. Do you have any idea how I can fix that?

  2. #22
    Senior Member
    Join Date
    Oct 2002
    Posts
    126
    I am not sure but I think that if you apply the code at the same level as the timeline tweening, the tweening will not work!
    A possible solution would be to put the colorise code inside the movieclip being tweened and make sure you give the movieclip instances the same name in each keyframe of the tweening. Hope it helps!

  3. #23
    Junior Member
    Join Date
    Oct 2009
    Posts
    2
    Sorry for bringing up old topics, but I've come across this very thread many times in my searching - thought I'd put my thoughts in!

    Simple enough to tween such a thing

    if you have a class (or if not - not sure how this sort of code works - I know it works with classes for sure), simply use the get/set functionality for a variable, having it redrawn Then use a tween class to tween that custom property.

    EG:

    Let's say this bit of code is within a class declaration (where public/private variables would go)
    Code:
    public function set tintRedCustom(newValue:uint):void
    {
        var colorTransform:ColorTransform = this.transform.colorTransform;
        colorTransform.color = newValue;
        this.transform.colorTransform = colorTransform;
    }
    then...
    Code:
    var rainbowTween:Tween = new Tween(this, "tintRedCustom", fl.transitions.easing.None.easeNone, 0, 16777214, 3, true);
    would make display object (referenced by This) tween a tint of rainbow!

    The possibilities are endless - just the moral of:

    If you have a set of code, and you want to tween one parameter or argument, but the property you want to edit or tween doesn't exists: make it!

    Hopefully this helps!

    `SiN

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center