[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 342
  • Last Modified:

AS2 Increase size of image while centering

I have a flash movie that when you click on the button "Decrease" the image shrinks in size. That works great except it's shrinking centered default on x=0 y=0 coordinates. I'd like to make it shrink at a specific coordinate x=961.75 y=365.70

This is the code I have for the button that works. How can I decrease the size centered on the specific coordinate?

on (press) {
      if (index < scaleSize.length && largemap._alpha == 100){
            largemap._xscale += 10;
            largemap._yscale += 10;
            SCALE.text = scaleSize[index--];
			SCALE2.text = SCALE.text;
      } else if (index < 0.5)
		  SCALE.text = "";
		  SCALE2.text = SCALE.text;

Open in new window

1 Solution
Your issue lies around the *registration point* of the largemap movieclip. Transforms (scales / rotations) use the registration point as the 'centre' of the clip when making the change.

I've always fixed these issues by entering a clip (edit it) and moving the content of a movieclip about until the relative positions of the content and the registration point were what I wanted. This is *really* easy to explain visually, but tough to do it in words, so sorry if that explanation passes you by. Try this - enter your movieclip and move your content about - say 200 pixels right and 300 down - run your movie and see how the behaviour of your zooming changes... Keep repeating this until you get (by iteration) your content in the right place of the movieclip to get the zooming behaviour you want.

I've also found a more visual description of this - http://www.kirupa.com/developer/mx/rpoint.htm
jj1103Author Commented:
Duh...such an oversight on my part. Yes, this worked. Thanks!

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now