Quantunet.com

My Account

Joins Us
Flash 8 Actionscript 2.0 QuickSkills

Shape Gradient Color Fill With Actionscript

 

How to gradient color fill shapes with actionscript:

  • Click on the first keyframe then open the actions panel".
  • Copy and paste this code in the "Actions" panel:

fillType = "linear";
colors = [0xF83680, 0x5844EA];
alphas = [100, 100];
ratios = [0, 255];
matrix = {matrixType:"box", x:50, y:50, w:150, h:100, r:0/180*Math.PI};
_root.lineStyle(2, 0x666666, 100);
_root.beginGradientFill(fillType, colors, alphas, ratios, matrix);
_root.moveTo(50, 50);
_root.lineTo(200, 50);
_root.lineTo(200, 150);
_root.lineTo(50, 150);
_root.lineTo(50, 50);
_root.endFill();

  • Press Ctrl + Enter to test the movie.
 

Note: To learn more about drawing with actionscript see [Actionscript Drawing Knowledgebase]

© 2008 Quantunet LLC All Rights Reserved | Intellectual Property | Terms of Use | Privacy
Home | About Quantunet | FAQ's | Contact Us