In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

flash on 2010-12-25

Graphics.drawRoundRectComplexを使って円を描画できるかテスト。

結果:
・幅、高さは同じ
・四辺の丸角の値は幅(高さ)の半分以上
で円になる。

ちなみに、Graphics.drawRoundRectの場合は…
・幅、高さは同じ
・丸角の幅と高さの値は幅(高さ)以上
Get Adobe Flash player
by geko 25 Dec 2010
    Embed
/**
 * Copyright geko ( http://wonderfl.net/user/geko )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/eoTF
 */

package {
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            var val:int = 100;
            
            graphics.beginFill(0x999999);
            //drawRoundRectComplexで円を描画
            graphics.drawRoundRectComplex(100, 100, val, val, val/2, val/2, val/2, val/2);
            //drawRoundRectで円を描画
            graphics.drawRoundRect(100, 250, val, val, val, val);
            graphics.endFill();
            
            graphics.lineStyle(1, 0xcccccc);
            graphics.beginFill(0xFFFFFF);
            graphics.drawRoundRectComplex(250, 100, val, val, val/2, val/2, 0, val/2);
            graphics.drawCircle(250+val/2, 100+val/2, val*3/7);
            graphics.endFill();
            graphics.beginFill(0xeeeeee);
            graphics.drawCircle(250+val/2, 100+val/2, val*5/11);
            graphics.endFill();            
        }
    }
}