A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Drawing API Stroke width remains fixed even on scalling

  1. #1

    Drawing API Stroke width remains fixed even on scalling

    Hi,
    I am working on a printing app where I am using Drawing API to draw a rectangle. I have provided a functionality to control stroke width of the rectangle
    Code:
    graphics.lineStyle(10,0x000000);
    For printing purpose I will need to scale the rectangle to higher resolution so I am using scaleX and scaleY to 5 times. But scalling the movieclip is not working with the stroke of the rectangle. The stroke remains the same.

    Please let me know how can i increase the stroke width when scaling the movieclip.

    Thanks
    Smile is a small curve which can solve big problems

  2. #2
    Senior Member
    Join Date
    Jan 2011
    Posts
    171
    I have no idea what you are trying to achieve.

    What I understood is you are trying to increasing the stroke size by scaling the container.

    Actionscript Code:
    var mc:MovieClip=new MovieClip();
    with(mc){
        graphics.beginFill(0x999999,1);
        graphics.lineStyle(10,0x333333,1,true,"normal");
        graphics.drawRect(0,0,200,100);
    }
    addChild(mc);
    mc.addEventListener(MouseEvent.CLICK,mcClicked);
    function mcClicked (evt:MouseEvent):void {
        evt.target.scaleX+=0.5;
        evt.target.scaleY+=0.5;
    }
    mc.x=10;
    mc.y=10;



    A Sprite Version in my preference.

    Actionscript Code:
    var sp:Sprite=new Sprite();
    with(sp){
        graphics.beginFill(0x999999,1);
        graphics.lineStyle(10,0x333333,1,true,"normal");
        graphics.drawRect(0,0,200,100);
    }
    addChild(sp);
    sp.addEventListener(MouseEvent.CLICK,spClicked);
    function spClicked (evt:MouseEvent):void {
        evt.target.scaleX+=0.5;
        evt.target.scaleY+=0.5;
    }
    sp.x=10;
    sp.y=10;




    arkitx
    Last edited by arkitx; 05-16-2012 at 03:17 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center