0

I have a bitmap in as3, I want its height to be 800, I want the width to be adjusted with the correct ratio so the image doesn't look squashed. How can I do this programatically in as3?

myImageBM.height = 800;
myImageBM.width = ??
asked Nov 6, 2011 at 20:02

2 Answers 2

2

Simply:

myImageBM.height = 800;
myImageBM.scaleX = myImageBM.scaleY;

Hope you'll find this usefull!!

answered Nov 6, 2011 at 21:59
Sign up to request clarification or add additional context in comments.

Comments

0

Try:

myImageBM.height = 800;
myImageBM.width = myImageBM.scaleY * myImageBM.width;

This is assuming you are just displaying it. For further processing of the image I would apply a matrix to it's bitmap data.

Of course if you are dealing with both portrait and landscape images it would be slightly more complicated, but the general idea is you set either height or width, then use the bitmap's scale properties to adjust the other dimension.

answered Nov 6, 2011 at 20:14

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.