Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is an alternate method that does not require a parent object. You basically use an AdjustColor and ColorMatrix to change the color instead of a ColorTransform. </p> <p>Note:If you are using an IDE other than Flash, like Flex or FlashDevelop, you will need to include flash.swc into your library from 'Common/Configuration/ActionScript 3.0/libs/flash.swc' for the <code>fl.motion.AdjustColor</code> package/class. You can also Google the swc.</p> <pre><code> var mc:Sprite = new Sprite(); mc.graphics.beginFill(0xFF0000); mc.graphics.drawCircle(100, 100, 100); mc.graphics.endFill(); addChild(mc); // White out the entire shape first var whiteAC:AdjustColor = new AdjustColor(); whiteAC.brightness = 100; whiteAC.contrast = 100; whiteAC.saturation = -100; whiteAC.hue = 0; var whiteMatrix:Array = whiteAC.CalculateFinalFlatArray(); var whiteCMF:ColorMatrixFilter = new ColorMatrixFilter(whiteMatrix); // Now use ColorMatrixFilter to change color var colorMatrix:Array = hexToMatrix(0x0000FF); var colorCMF:ColorMatrixFilter = new ColorMatrixFilter(colorMatrix); // Create Drop Shadow var myDropShadow:DropShadowFilter = new DropShadow(); mc.filters = [whiteCMF, colorCMF, myDropShadow]; function hexToMatrix ( hex:uint, alpha:Number = 1 ) { var r:Number = ((hex &amp; 0xFF0000) &gt;&gt; 16); var g:Number = ((hex &amp; 0x00FF00) &gt;&gt; 8); var b:Number = ((hex &amp; 0x0000FF)); var matrix:Array = []; matrix = matrix.concat([r, 0, 0, 0, 0]); // red matrix = matrix.concat([0, g, 0, 0, 0]); // green matrix = matrix.concat([0, 0, b, 0, 0]); // blue matrix = matrix.concat([0, 0, 0, alpha, 0]); // alpha return matrix; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload