Skip to main content
Inspiring
May 19, 2013
Answered

scroll-resizer problem

  • May 19, 2013
  • 1 reply
  • 931 views

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();

}

This topic has been closed for replies.

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
May 19, 2013
Inspiring
May 19, 2013

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.

Inspiring
May 19, 2013

it wasn't scale because i didn't press shift key as it turn out. 

thank you