Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

scroll-resizer problem

Participant ,
May 18, 2013 May 18, 2013

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

}

TOPICS
ActionScript
837
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 19, 2013 May 19, 2013
Translate
Community Expert ,
May 19, 2013 May 19, 2013
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 19, 2013 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 19, 2013 May 19, 2013

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

thank you

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 19, 2013 May 19, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 19, 2013 May 19, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 20, 2013 May 20, 2013
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines