Hi guys,

I uses AS3 to draw a shape with gradient as below, now I am going to draw
more complex shape.. can you please help me on this? ==>>
http://www.minlab.net/upload/files/shapes.swf


=============

package {
    import flash.display.DisplayObject;
    import flash.display.Graphics ;
    import flash.display.Shape;
    import flash.display.Sprite;
    import flash.display.GradientType
    import flash.display.SpreadMethod
    import flash.geom.*

    public class GraphicsExample extends Sprite {
        private var shapeWidth:uint   = 500;
        private var shapeHeight:uint  = 20;
        //private var bgColor:uint    = 0xFFCC00;
        private var borderColor:uint  = 0x000000;
        private var borderSize:uint   = 2;
        private var cornerRadius:uint = 6;
        private var xPostion:int      = 20;
        private var yPostion:int      = 20;

        public function GraphicsExample() {

            doDrawShape();
        }
        private function doDrawShape():void {
            var child:Shape = new Shape();

              var fillType:String = GradientType.LINEAR;
              var colors:Array = [0x000000, 0x666666];
             var alphas:Array = [100, 100];
              var ratios:Array = [0, 255];
            var matr:Matrix = new Matrix();

            matr.createGradientBox(shapeWidth,shapeHeight, Math.PI / 2, 0,
0);
            var spreadMethod:String = SpreadMethod.PAD;

            child.graphics.lineStyle(borderSize, borderColor);

            child.graphics.beginGradientFill(fillType, colors, alphas,
ratios, matr, spreadMethod);
            child.graphics.drawRoundRect(xPostion, 10, shapeWidth,
shapeHeight, cornerRadius);
            addChild(child);
        }

    }
}
=================
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to