A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: transparency

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    6

    transparency

    Due to lack of experience I am struggling with the following problem:
    I use actionscript 3.0 in flash CS3.

    I have made a movieclip from a blue rectangle. (by example)
    Then I want to change the blue color into a red color.
    The following cannot work. How can I do it correctly?

    package{
    import flash.display.MovieClip;
    import fl.motion.Color;

    import mcRectangle;

    public class RectangleClass extends MovieClip{
    var rectangle:mcRectangle;

    public function RectangleClass(){
    rectangle = new mcRactangle();
    rectangle.x = 0; rectangle.y = 0;
    rectangle.Color.setTint(0xFF0000,1); //hmmm
    this.addChild(rectangle);
    }
    }
    }

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518
    Code:
    package {
            import flash.display.MovieClip;
            import fl.motion.Color;
            import flash.geom.ColorTransform;
    
            public class RectangleClass extends MovieClip {
                    private var rectangle:mcRectangle;
    
                    public function RectangleClass() {
                            rectangle = new mcRectangle();
                            rectangle.x = 0;
                            rectangle.y = 0;
                            var start_color:Color = new Color();
                            start_color.setTint(0xFF0000, 1);
                            var colorInfo:ColorTransform = rectangle.transform.colorTransform;
                            colorInfo.color = start_color.tintColor;
                            rectangle.transform.colorTransform = colorInfo;
                            addChild(rectangle);
                    }
            }
    }

  3. #3
    Junior Member
    Join Date
    Nov 2013
    Posts
    6
    Thanks a lot!

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