Jodo-Milano.2008-09_035Kyoto
2011-05-04
Shimogamo
Jinja,
Jikishinkageryu
NaginatajutsuKobujutsu
Stadion
2011-12-17
2Jikishinkageryu
Naginatajutsu
in Hyogo
Kenritsu
Budokan,
Himeji
2011-05-29Somero2002_02South.Africa.Roadtrip.2007-08_216Naginata
Helsinki
2010-02-07
09Shiga,
Japan
2010-04-18Oslo
2010-12-03Minatogawa
Jinja,
Kobe
2011-06-20Vesa-Rauttu-60v_1899South.Africa.Roadtrip.2007-08_353Nanbudo_Norge2007-12_211Kobe,
Japan
2010-04-28italia2005-04_219Kuortti.2010-06-26Kyoto
2011-05-04
Shimogamo
Jinja,
Ryukyu
Kobujutsu
- Bo
kumiteOsaka,
Japan
2010-04-29italia2005-05_131Helsinki2005-10-15_16_042Oslo
2010-12-04Pakkas03Pitkanen_076
Very fine Finnish tar shampoo

A bottle of the fine Finnish tar shampoo

Differences in drawRoundRect and drawRoundRectComplex

It seems that drawRoundRectComplex is not even documented by Adobe in their AS3 language reference, but referred elsewhere in their documentation. drawRoundRect can be found.

Anyhow, the code shown here will demonstrate the differences with the two rounded corner rectangle drawing functions which are available in the flash.display.Graphics class. The white whale looking box is using the "complex" version.

The main differences are the way these two functions are handling the last parameters, latter one is calling them as radius, where as the simpler one as with and height.

package
{
    import flash.display.*;
    import flash.events.Event;
   
    [SWF(backgroundColor = '0x668822', frameRate = '33', width = '420', height = '400')]
   
    public class RoundedCornersTest extends Sprite
    {
        private var _radius:Number = 40;
        private var _margin:Number = 25;
        private var _width:Number = 340;
        private var _height:Number = 150;
       
        public function RoundedCornersTest()
        {
            stage.align = StageAlign.TOP_LEFT;
            stage.scaleMode = StageScaleMode.NO_SCALE;
           
            loaderInfo.addEventListener(Event.INIT, onInit);
        }

        private function onInit(event:Event):void
        {
            var gra:Graphics = graphics;
           
            gra.beginFill(0x121212);
            gra.drawRoundRect(_margin, _margin, _width, _height,
                _radius, _radius);
            gra.endFill();
           
            gra.beginFill(0xF4F4F4);
            gra.drawRoundRectComplex(_margin, _margin * 2 + _height,
                _width, _height,
                _radius, _radius,
                _radius, -_radius);
            gra.endFill();
           
            // Lines for clearer visual presentation
            gra.lineStyle(1, 0xF84828, 0.8);
            gra.moveTo(_margin + _radius, 0);
            gra.lineTo(_margin + _radius, stage.stageHeight);
            gra.moveTo(_margin + _width - _radius, 0);
            gra.lineTo(_margin + _width - _radius, stage.stageHeight);
            gra.moveTo(0, _margin + _radius);
            gra.lineTo(stage.stageWidth, _margin + _radius);
            gra.moveTo(0, _margin + _radius);
            gra.lineTo(stage.stageWidth, _margin + _radius);
            gra.moveTo(0, _margin + _height - _radius);
            gra.lineTo(stage.stageWidth, _margin + _height - _radius);
            gra.moveTo(0, _margin * 2 + _height + _radius);
            gra.lineTo(stage.stageWidth, _margin * 2 + _height + _radius);
            gra.moveTo(0, _margin * 2 + _height * 2 - _radius);
            gra.lineTo(stage.stageWidth, _margin * 2 + _height * 2 - _radius);
        }
    }
}

More complex shapes are now possible with a one function, if you manage to calculate different values for each corner.

RoundedCornersTest.swf

Time: 09/07/2009 17:48

QR code for paazio.nanbudo.fi