Jump to content

Uma ajuda a redimensionar uma imagem


tibi
 Share

Recommended Posts

Bons dias

Estou com um problema, pois tenho uma imagem grande no flash, devido as maiores resolucoes. Depois pretendo redimensiona la para uma determinada medida.

ai esta o meu problema

O que eu prentendia era redimensiona la mas sem distorcer a imagem.

eu tenho o seguinte:

Stage.align = ("TL");
Stage.scaleMode = "noScale";


stageListen = new Object();
stageListen.onResize = function ()
{
    strechLayout();
}
;
Stage.addListener(stageListen);
strechLayout = function ()
{
    if (Stage.width > 800) 
    {
       	imagem._x = 0;
                     imagem._width = Stage.width - 200;


    }

    if (Stage.height >600) 
    {
	imagem._y = 0;
	imagem._height = AQUI ESTA O MEU PROBLEMA;


}

}
;
stageListen.onResize();

como e que eu calculo a altura para a imagem se a fazer distorcer.

Obrigado

Link to comment
Share on other sites

Boas,

voce esta a analisar mal, quando mexe um width tem que mexer também no height, e vice versa

para calcular a altura mediante a largura, usa isto:

imagem._height -= imagem._height / (imagem.width + 200)

tens que fazer duas rotinas, uma para ver se a largura esta maior que 800, e outra para ver se altura esta maior do que 600

Um abraço

PS: eu editei isto, peço desculpa mas a minha resposta estava incompleta

Link to comment
Share on other sites

Boas,

mete um mc chamado teste_mc no primeiro frame, no segundo frame mete este codigo, acho que percebes melhor a ideia, eu so estou a testar a largura, tens que fazer o inverso para a altura

if (teste_mc._width>1) {
teste_mc._width -= 1;
teste_mc._height -= (teste_mc._height/(teste_mc._width+1));
}

acho que percebes melhor a ideia, eu so estou a testar a largura, tens que fazer o inverso para a altura

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
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.