Jump to content
GreenSock

BernalCarlos

Constrain Scaling To avoid Mirror Efects - New Problem

Moderator Tag

Recommended Posts

Hello,

 

i have already asked this question in the following thread: http://forums.greensock.com/topic/6964-constrain-scaling-to-avoid-mirror-efects/

 

The solution was to set the minScaleX and minScaleY to 0 and that worked, but now I need to constrain the width and height of a transformItem, not the scale. 

 

So, i used the minWidth and minHeight properties of the item. At the beginning its seemed to work, however if I keep scaling beyond the min values, the item will eventually jump to negative scale values.

 

I think its a bug but i don't know, any help will be greatly appreciated.

 

Here a .fla that shows the problem:

https://www.dropbox.com/s/wx6vtjho4vn0t9k/TransManager_MinWidthBug.fla

 

Thank you.

Link to comment
Share on other sites

Actually, no that's not a bug at all because it is entirely possible to have an object that's a certain width even at negative scale values. For example, if you've got a 100px wide object and you set the minWidth to 50, that means that if its scaleX is -0.7, that would make it 70px wide, thus it's totally "legal". 

 

Believe it or not, it took quite some effort to make that "bug" work that way :) It is entirely intentional. But if you don't want to allow the scale to go negative, just add these lines:

_transItem.minScaleX = 0;
_transItem.minScaleY = 0; 

Does that clear things up?

Link to comment
Share on other sites

ooo I see, sorry for sugesting that it could be bug. But, can is use minWidth and minScale at the same time?, I cant try it rigth now. Thank you Jack.

Link to comment
Share on other sites

Yep, you can use them both together. 

 

Have fun :)

Link to comment
Share on other sites

Great, it works.

 

Sorry for the dumb question and thank you very much for your help.

Link to comment
Share on other sites

No problem at all. Enjoy.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×