Adding a Simple One-Color Fill : graphics « Graphics « Flash / Flex / ActionScript

Home
Flash / Flex / ActionScript
1.Animation
2.Array
3.Class
4.Data Type
5.Development
6.Function
7.Graphics
8.Language
9.Network
10.Regular Expressions
11.Statement
12.String
13.TextField
14.XML
Flash / Flex / ActionScript » Graphics » graphics 
Adding a Simple One-Color Fill
 
package{
  import flash.display.*;
  
  public class Main extends Sprite{
    public function Main(){
        var shape:Shape = new Shape ();
        shape.graphics.lineStyle(00xFF0000);
        shape.graphics.beginFill(0xFFFF00,100);
        
        shape.graphics.lineTo(1000);
        shape.graphics.lineTo(100100);
        shape.graphics.lineTo(0100);
        shape.graphics.lineTo(00);
        shape.graphics.endFill();
        addChild(shape);

    }
  }
}

        
Related examples in the same category
1.Introducing the Graphics Object
2.Creating Fills
3.Drawing Circles
4.Drawing Rounded Rectangles
5.Draw lines
6.Use the graphics
7.Change line style
8.Change scaleX
9.Set Shape position
10.Draw three shapes
11.Draw four shapes
12.Moving the Pen without Drawing
13.Drawing a Straight Line
14.Drawing a Curve
15.To move the drawing pen without drawing any line at all, use moveTo( ).
16.To remove all vector drawings in an object, we use the Graphics class's instance method clear( ).
17.Drawing Lines in a Graphics Object
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.