Square : Rectangle : Graphics Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Graphics » Rectangle »

 

Square


 

package {
     
     import flash.display.Sprite;
     
     [SWF(width=550, height=400)]
     
     public class Main extends Sprite {  
     
          public function Main() {
               var square:Square = new Square();
               addChild(square);
               
               // Move to (300,300)
               square.x = 30;
               square.y = 30;
               
               // Stretch horizontally and squash vertically
               square.scaleX = 2;
               square.scaleY = 0.5;
               
               // Make 50% alpha
               square.alpha = 0.5;
               
               // Rotate 45 degrees
               square.rotation = 45;
          }
     
     }
     
}

class Square extends flash.display.Sprite {

     public function Square() {
          graphics.lineStyle(5);
          graphics.beginFill(0xFF);
          graphics.drawRect(00100100);
          graphics.endFill();
     }

}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Graphics
» Rectangle