티스토리 뷰

// ActionScript file


import flash.display.Shape;
import flash.display.Sprite;

 

private function initApp():void {
     var sh:Shape = new Shape();
     addChild(sh);
     var g:Graphics = sh.graphics;
     g.lineStyle(5, 0x000000, 1);
     g.beginFill(0x000000, 1);
     g.drawEllipse(0,0, 200, 100);
 
     var circle:Sprite = new Sprite();
     circle.graphics.beginFill(0x000000);
     circle.graphics.drawCircle(50,50,30);
     circle.graphics.endFill();
     addChild(circle);
}

-------------------------------------------------------------------------------------------------------------------

     addChild(circle);

     사용시에는 Flex 에서 1034 오류가 발생하였지만,

 

     bgBitmap.rawChildren.addChild(circle);

     으로 변경하면 정상적으로 bgBitmap(Canvas)에 정상 출력됨 / 

 

     rawChildren.addChild(circle);

     Application 에 바로 출력됨.

     

 

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

 
< ?xml version="1.0" encoding="utf-8"?>
< !-- http://blog.flexexamples.com/2008/09/09/rounding-the-corners-of-an-image-control-in-flex-using-a-mask/ -->
< mx:Application name="Image_mask_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();">
 
    <mx:Script>
        <![CDATA[
            import mx.events.ResizeEvent;
 
            private var roundedMask:Sprite;
 
            private function init():void {
                roundedMask = new Sprite();
                canvas.rawChildren.addChild(roundedMask);
            }
 
            private function image_resize(evt:ResizeEvent):void {
                var w:Number = evt.currentTarget.width;
                var h:Number = evt.currentTarget.height;
                var cornerRadius:uint = 60;
                roundedMask.graphics.clear();
                roundedMask.graphics.beginFill(0xFF0000);
                roundedMask.graphics.drawRoundRect(0, 0,
                            w, h,
                            cornerRadius, cornerRadius);
                roundedMask.graphics.endFill();
                image.mask = roundedMask;
            }
        ]]>
    </mx:Script>
 
    <mx:Canvas id="canvas">
        <mx:Image id="image"
                source="http://www.helpexamples.com/flash/images/image1.jpg"
                resize="image_resize(event);">
        </mx:Image>
    </mx:Canvas>
 
< /mx:Application>

Total
Today
Yesterday
최근에 올라온 글
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31