A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: set color and brightness

  1. #1
    Bob (the singing sock)
    Join Date
    Aug 2000
    Location
    Århus, Denmark
    Posts
    472

    set color and brightness

    I am dynamically setting color on my menu objects
    Code:
    SetWheelColor.newColor = "0x5B7CA7";
    for(i=0;i<5;i++) {
    	myColor = new Color(menu["menu" + (i+1)]);
    	myColor.setRGB(SetWheelColor.newColor);
    }
    My question is ... how do I increase brightness dynamically for the five objects? I am looking for an instant effect - not a gradual change.

    //Poden

  2. #2
    Senior Member Computer Dork's Avatar
    Join Date
    Mar 2001
    Location
    St. Louis
    Posts
    1,026
    set the rgb higher - there is no brightness script, unfortuately.

  3. #3
    Senior Member
    Join Date
    Nov 2000
    Posts
    302
    I believe i did it by cranking up the R, the G and the B by the same value.

    cYa
    [swf width="300" height="40" background="#FFDDBB"]http://www.cid-iv.com/flash/Banner/footer.swf[/swf]

  4. #4
    Senior Member
    Join Date
    Nov 2000
    Posts
    302
    Hey, Dork, you just slipped in between. But that's it indeed.
    [swf width="300" height="40" background="#FFDDBB"]http://www.cid-iv.com/flash/Banner/footer.swf[/swf]

  5. #5
    Bob (the singing sock)
    Join Date
    Aug 2000
    Location
    Århus, Denmark
    Posts
    472
    Thanks guys ...
    But how do i do that dynamically?

    //pod

  6. #6
    Senior Member
    Join Date
    Nov 2000
    Posts
    302
    myColor=new Color(yourClip);
    myColor.setTransform(colorTransformObject);

    colorTransformObject:
    ra = perc. red (-100 to 100)
    rb = offset red (-255 to 255)
    ga = perc. green (-100 to 100)
    gb = offset green (-255 to 255)
    ba = perc. blue (-100 to 100)
    bb = blue offset (-255 to 255)
    aa = perc. alpha (-100 to 100)
    ab = offset alpha (-255 to 255)
    [swf width="300" height="40" background="#FFDDBB"]http://www.cid-iv.com/flash/Banner/footer.swf[/swf]

  7. #7
    Bob (the singing sock)
    Join Date
    Aug 2000
    Location
    Århus, Denmark
    Posts
    472
    Yeah, thanks I got the colortransform object wich makes working with dynamic colors easy.

    But how do i convert the hex-color into the colorTransformObject to be able to adjust values dynamically?

    //pod

  8. #8
    Bob (the singing sock)
    Join Date
    Aug 2000
    Location
    Århus, Denmark
    Posts
    472
    I got it!
    - this code increases brightnes of "menu[i]" to the hex value in newcolor.
    Code:
    newColor = "0x5B7CA7";
    rgb = newColor;
    red = (rgb >> 16) & 0xFF;
    green = (rgb >> 8) & 0xFF;
    blue  = rgb & 0xFF;
    for(i=0;i<5;i++) {
    	factor = i * 20 - 40;
    	myColor = new Color(["menu" + (i+1)]);
    	myColor.setRGB(SetWheelColor.newColor);
    	brightness = new Color(menu["menu" + (i+1)]); 
    	brightnessTransform = new Object( );
    	brightnessTransform.rb = red + factor; 
    	brightnessTransform.gb = green + factor;
    	brightnessTransform.bb = blue + factor;
    	brightness.setTransform(brightnessTransform);
    }
    thx anyroad
    //pod

  9. #9
    Senior Member
    Join Date
    Nov 2000
    Posts
    302
    You're welcome, dude!
    [swf width="300" height="40" background="#FFDDBB"]http://www.cid-iv.com/flash/Banner/footer.swf[/swf]

  10. #10
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,358
    see

    http://proto.layer51.com/default.aspx

    look at the color section there for some color functions. One there that might be useful is blendRGB() where you can take the color which the clip is currently and blend it with white by a t value of like .5 or something.


    myColor.blendRGB(0xffffff, .5);

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