Copy link to clipboard
Copied
Hello!
I made this script for a resizer scroller, basically scaleTransform_mc is a mc that, more it move close to its _x = 80, Square_mc will resize itself accordingly.
this script is working at the moment, however if I rotate Square_mc 90 degrees, either cw or cc. it doesn't work. I wonder why, script is pretty basic
scaleTransform_mc.onPress = function(){
startDrag(this,0, 0, 100, 80, 100); << scroll mc from _x = 0 to 80;
//
this.onMouseMove = function() {
var ori_width= Square_mc._width;
var ori_height = Square_mc._height;
var height_ratio = ori_height/ori_width; << lets say square is 4X4 the ratio would be 1
var xmouse = this._x;
var ymouse = this._y;
var minWidth = xmouse+ 5; << set min width for square is no less than 5 ( so ppl can still see even scroll all the way to left)
//trace(xmouse);
//trace(ymouse);
Square_mc._width = minWidth*2.5; << square width be same as scale_x times 2.5
Square_mc._height = height_ratio*Square_mc._width ; << height is square_height times height_ratio
}
}
scaleTransform_mc.onRelease = function() {
stopDrag();
}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi kglad, thanks reply
is this in as2.. ?
There are a couple of these transform codes in as2 that I found on web, but so far all of them doesn't keep the object proportional. meaning when you pull the mc out, it stretch, either to _x or _y direction, the code doesn't allow you do it like in photoshop while holding shift and pull will keep the original scale.
I tried to make something simple because ppl who use my site is very concern their art being keep at original scale, that I would rather have rotation function on a seperate button.
Copy link to clipboard
Copied
it wasn't scale because i didn't press shift key as it turn out.
thank you
Copy link to clipboard
Copied
no, that's as3.
but it explains how flash measures width/height after transforms (like rotations) and you can see how senocular solved the problems you're facing.
Copy link to clipboard
Copied
i see, although it really look much easier if I just use the code instead... I originally thought they could only make it resize without scale, but now i checked I ve missed the fact that I could do shift+pull just like in photoshop thats different story.
And that's way better than my way they can do whole lot more,
mine just zoom in and out , and that's about it.
thank you again, this code is amazing.
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now