AS2 Increase size of image while centering

Posted on 2012-08-17
Last Modified: 2012-08-20
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

Question by:jj1103
    LVL 4

    Accepted 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 -

    Author Comment

    Duh...such an oversight on my part. Yes, this worked. Thanks!

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
    In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
    In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
    The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now