A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: help: Color changing function

Hybrid View

  1. #1
    Member
    Join Date
    Sep 2007
    Posts
    57

    help: Color changing function

    Working in AS2 here trying to make a simple function to change the color of an object passed to it. I'm not getting a complier error but it's not working either.

    PHP Code:
    import flash.geom.ColorTransform;

    function 
    color_change(colormc) {
        var 
    colorTrans = new ColorTransform();
        
    colorTrans.rgb color;
        
    mc.colorTransform colorTrans;

    I'm using the function call below:
    PHP Code:
    change_color(0xFFFF00_root.stabar); 
    Thanks for the help.

  2. #2
    Senior Member rachil0's Avatar
    Join Date
    Jul 2007
    Location
    Columbus, OH.
    Posts
    465
    Does an AS2 movieclip have a "colorTransform" member, or are you just adding a new member and assigning it a value? (I think the latter would have no effect).

    I never did much AS2. The way I read the documentation, it says that you should add a new flash.filters.ColorMatrixFilter to the MovieClips "filters" member (filters is an array, just push the ColorMatrixFilter at the end). Someone with greater AS2 experience can probably be more helpful.

  3. #3
    file not found Captain_404's Avatar
    Join Date
    Apr 2006
    Posts
    457
    I beleive you may be looking for something along these lines:

    Code:
    function color_change(color, mc) { 
        var colorTrans = new Color(mc); 
        colorTrans.setRGB(0x000000);
    }
    This is just off the top of my head though, so I'm not sure if it will work like you want.

  4. #4
    Member
    Join Date
    Sep 2007
    Posts
    57

    That Worked

    Oddly enough that did. I was using the import because the CS3 help file says (for .getRGB):
    Deprecated since Flash Player 8. The Color class has been deprecated in favor of the flash.geom.ColorTransform class.
    I used the import successfully in another AS2 script I made but oh well. It works, I'm running with it. Thanks for the help.

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