9 Replies Latest reply on Jan 15, 2007 4:20 AM by mxc

    x-scale and relative x and y values!!!??

    jude86
      Please help!!

      This is driving me crazy!! I have a main movie clip which is a background, this needs to be scaled to fit onto an A4 page for printing, this i can do with the xscale, however i also have dragable movie clips which go on top of the background, when i xscale these they go smaller, however their x and y values remain the same, as they did before xscaleing anything, so they are outside of the boundary of the main background.

      Basically all i need to know is there anyway of changing the dragable _mc's x and y values relative to the main_mc's xscale value??

      Please help it is much appreciated

      Thanks
        • 1. Re: x-scale and relative x and y values!!!??
          mxc Level 1
          i generally use percentages for this kind of thing but I am not sure exactly what you want to do? Can you post an example?

          regards
          michael
          • 2. Re: x-scale and relative x and y values!!!??
            jude86 Level 1
            well its probably best i try to describe because action script wont give you much of an idea.

            Say i have on grey box (this is main_mc) and one smaller red box (this is redBox_mc).

            Main_mc is the background and i want to scale it by 70% so the code would be:

            main_mc.xscale = 70;

            redBox_mc is a dragable object that can be dragged inside and out of main_mc......where its position lies is important.......therefore when i scale this by:

            redBox_mc.xscale = 70;

            redBox_mc is in proportion with main_mc however because the x and y values of redBox_mc have remained the same, but the size of main_mc is smaller, redBox_mc appears to be no longer inside of main_mc.

            So i need to be able to change the x and y values of redBox_mc so it still looks like it is in the same place as it does before i scale anything.

            I hope that makes it a little clearer, i would happily attach a drawing to demonstate but i dont know how!! lol!!

            Many thanks
            • 3. Re: x-scale and relative x and y values!!!??
              mxc Level 1
              ok so you want proportional scaling? What about the yscale?
              • 4. Re: x-scale and relative x and y values!!!??
                jude86 Level 1
                Yes, proprtional scaling would be good how do i do this?? the yscale will be the same as the xscale i mentioned :D

                Cheers
                • 5. Re: x-scale and relative x and y values!!!??
                  mxc Level 1
                  Ok thats the first step but to work out the solution the next thing I need to know is
                  do we need to work out where the redBox has been dragged before the scaling is done?

                  For example does the user drag stuff around then click a button that scales everything down?
                  • 6. Re: x-scale and relative x and y values!!!??
                    jude86 Level 1
                    yes sort of......the user will need to drag various mc's around, so in this case it's the red box once the user has finished dragging items around and they are happy they are complete they click the 'print' button, this is where i have the script to scale down the mc's, before the page is printed

                    Cheers
                    • 7. Re: x-scale and relative x and y values!!!??
                      mxc Level 1
                      Ok the following code sets up just 2 clips mc1 is the main clip, for example your background and mc2 is the clip which can be moved around. You can add as many draggable clips as you like as long as you set them up like mc2. If you have a lot og draggable clips then it is a good idea to use a loop to set them up. Anyway the formula for keeping in proportion is the same.

                      I hope I have explained it ok :)
                      • 8. Re: x-scale and relative x and y values!!!??
                        jude86 Level 1
                        Many thanks that's a great help!!

                        Cheers :D
                        • 9. Re: x-scale and relative x and y values!!!??
                          mxc Level 1
                          Your welcome. You can adapt the code to suit your own code structure, obviously you can move the vars out of the onRelease function and write something that fits better to your frag n drop app for example. If you have a question about anything when you get around to putting it together I will be glad to try and answer. Best of luck with it.