This content has been marked as final. Show 9 replies
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?
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!!
ok so you want proportional scaling? What about the yscale?
Yes, proprtional scaling would be good how do i do this?? the yscale will be the same as the xscale i mentioned :D
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?
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
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 :)
Many thanks that's a great help!!
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.