A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: resizing movieclip

  1. #1
    Member
    Join Date
    Oct 2008
    Posts
    48

    resizing movieclip

    Hello

    I have a simple movieclip and when I resize it with scaleX and scaleY functions, the movieclip's left-top corner will stay at the same place.

    How can I change it so that it will resize from the center - so that the center of the movieclip will stay at the same place (without changing the x and y coordinates)?

    Many thanks in advance!

  2. #2
    Teacosy is coming ranoka's Avatar
    Join Date
    Jun 2003
    Location
    UK
    Posts
    123
    Did you make the MovieClip in Flash?
    The MovieClip scales from where the registration point is. By default it's at the top left, but if you want it to scale it from the centre you need to move the registration point to the centre. If you select the content you can align it to the centre.

    If you don't want to move the content of the MovieClip (so you don't have to adjust the positing code and stuff), you can put it inside another MovieClip with the registration point in the centre. You will need to give that clip an instance name and change the code to talk to the original clip inside the new wrapper clip.

    Hope that helps.

  3. #3
    Member
    Join Date
    Oct 2008
    Posts
    48
    No, I didnt make the MovieClip in Flash.

    I create dynamically with Actionscript 3. How can I move the registration point to the center?

    Thanks a lot!

  4. #4
    Teacosy is coming ranoka's Avatar
    Join Date
    Jun 2003
    Location
    UK
    Posts
    123
    I guess you'll need to move the content of the MovieClip (not the MovieClip itself) by half of the width and height. And then move the MovieClip from the (not the content) in the opposite direction by the same amount to get the registration point in the centre. This will prevent the MovieClip from visually moving, but get the registration point to the centre.

    Or when you create the content of the MovieClip, set the x and y (of the content) by half of the heigh and width and then shuffle the MovieClip the opposite direction.

  5. #5
    Member
    Join Date
    Oct 2008
    Posts
    48
    Thanks a lot. I found a class for actionscript 3 which you can derive from, to set the registry points.

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