A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Scale a rectangle from center

  1. #1
    Junior Member
    Join Date
    Dec 2010
    Posts
    2

    Scale a rectangle from center

    hello,

    i have a simple rectangle.
    i would like to scale it to 200 but the scaling always begins from top-left corner of the rectangle.
    how can i scale it from the center?
    thank you!

    Actionscript Code:
    rect.onPress = mousePress;
    rect.onRelease = mouseRelease;
    function mousePress():Void {
        var item:MovieClip = this;
        item._xscale = item._yscale = 200;
    }
    function mouseRelease():Void {
        var item:MovieClip = this;
        item._xscale = item._yscale = 100;
    }
    Attached Files Attached Files
    Last edited by belo; 12-08-2010 at 01:41 PM.

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    set its registration points centered, in other words center the shapes in it.

    gparis

  3. #3
    Junior Member
    Join Date
    Dec 2010
    Posts
    2
    can you please show me what you mean. i have attached a test.fla

  4. #4
    anyone else hear that? flashpipe1's Avatar
    Join Date
    Jan 2003
    Location
    Upstate NY
    Posts
    1,930
    No attachment there, but, if you double click on your symbol, select it and use the "Align" panel (select "To stage") and center it horizontally and vertically, that should set the registration point to the center and it will scale from that point...
    Hope that helps!
    Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.

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