Re: [Flashcoders] Resizing a background image only.And keeping aspect ratio.

2008-02-03 Thread Pedro Kostelec
Perhaps sth like this would work:
original_picture_width=550;
original_picture_height=400;

picture_mc.width=stage.stageWidth;
picture_mc.height=(stage.stageWidth /
original_picture_width)*original_picture_height;

I am not sure it is completely as3, becasue i just started learning it, so
you perhaps should mdify it a bit.
WIth this i think you should keep the aspect ratio


On Feb 3, 2008 4:12 AM, Vlado Krempl [EMAIL PROTECTED] wrote:

 Hello everyone,


 Question:  (Using actionscript 3)

 How to scale just the background image (photograph) fullscreen in the
 browser but still keep it's aspect ratio.
 All the solutions on the internet seem to still be in Actionscript 2.  I'm
 using the code below -

  
 -

 stage.addEventListener(Event.RESIZE, onStageResize);

  function onStageResize(event:Event):void {

 picture_mc = 

  }

 --

 I've tried stage.stagewidth and scaleX = stage.width; but they all distort
 the image when resized.

 Anyone have a clue?

 Thanks.



 Vlado

 Please consider the environment before printing this e-mail.
 The contents of this message should be treated as COMMERCIAL IN CONFIDENCE
 unless otherwise specified in the message
 and is intended solely for the use of the individual or entity to whom it
 is addressed.
 If you have received this email in error please notify the sender. If you
 are not the named addressee you should not disseminate, distribute or copy
 this e-mail.
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




-- 
Pedro D.K.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Resizing a background image only.And keeping aspect ratio.

2008-02-03 Thread Pedro Kostelec
Oh,
It is picture_mc.scaleX and not picture_mc.width
and
picture_mc.scaleY instead of picture_mc.height

At least i supose

On Feb 3, 2008 12:29 PM, Pedro Kostelec [EMAIL PROTECTED] wrote:

 Perhaps sth like this would work:
 original_picture_width=550;
 original_picture_height=400;

 picture_mc.width=stage.stageWidth;
 picture_mc.height=(stage.stageWidth /
 original_picture_width)*original_picture_height;

 I am not sure it is completely as3, becasue i just started learning it, so
 you perhaps should mdify it a bit.
 WIth this i think you should keep the aspect ratio


 On Feb 3, 2008 4:12 AM, Vlado Krempl [EMAIL PROTECTED] wrote:

  Hello everyone,
 
 
  Question:  (Using actionscript 3)
 
  How to scale just the background image (photograph) fullscreen in the
  browser but still keep it's aspect ratio.
  All the solutions on the internet seem to still be in Actionscript 2.
   I'm using the code below -
 
   
  -
 
  stage.addEventListener(Event.RESIZE, onStageResize);
 
   function onStageResize(event:Event):void {
 
  picture_mc = 
 
   }
 
  --
 
  I've tried stage.stagewidth and scaleX = stage.width; but they all
  distort the image when resized.
 
  Anyone have a clue?
 
  Thanks.
 
 
 
  Vlado
 
  Please consider the environment before printing this e-mail.
  The contents of this message should be treated as COMMERCIAL IN
  CONFIDENCE unless otherwise specified in the message
  and is intended solely for the use of the individual or entity to whom
  it is addressed.
  If you have received this email in error please notify the sender. If
  you are not the named addressee you should not disseminate, distribute or
  copy this e-mail.
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 



 --
 Pedro D.K.




-- 
Pedro D.K.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Resizing a background image only.And keeping aspect ratio.

2008-02-03 Thread Kenneth Kawamoto

It could be cleaner, but here we go:

private function onStageResize(e:Event):void {
  var picRatio:Number = picture_mc.width/picture_mc.height;
  var stageRatio:Number = stage.stageWidth/stage.stageHeight;
  if(picRatio  stageRatio){
 picture_mc.width = stage.stageWidth;
 picture_mc.height = picture_mc.width/picRatio;
  } else {
 picture_mc.height = stage.stageHeight;
 picture_mc.width = picture_mc.height*picRatio;
  }
}

Kenneth Kawamoto
http://www.materiaprima.co.uk/

Vlado Krempl wrote:

Hello everyone,


Question:  (Using actionscript 3) 


How to scale just the background image (photograph) fullscreen in the browser 
but still keep it's aspect ratio.
All the solutions on the internet seem to still be in Actionscript 2.  I'm 
using the code below -
 
-

stage.addEventListener(Event.RESIZE, onStageResize);
 
 function onStageResize(event:Event):void {


picture_mc =  
 
 }

--

I've tried stage.stagewidth and scaleX = stage.width; but they all distort the 
image when resized.

Anyone have a clue?

Thanks.



Vlado

  

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Resizing a background image only.And keeping aspect ratio.

2008-02-02 Thread Vlado Krempl
Hello everyone,


Question:  (Using actionscript 3) 

How to scale just the background image (photograph) fullscreen in the browser 
but still keep it's aspect ratio.
All the solutions on the internet seem to still be in Actionscript 2.  I'm 
using the code below -
 
-

stage.addEventListener(Event.RESIZE, onStageResize);
 
 function onStageResize(event:Event):void {

picture_mc =  
 
 }
--

I've tried stage.stagewidth and scaleX = stage.width; but they all distort the 
image when resized.

Anyone have a clue?

Thanks.



Vlado
 
Please consider the environment before printing this e-mail. 
The contents of this message should be treated as COMMERCIAL IN CONFIDENCE 
unless otherwise specified in the message
and is intended solely for the use of the individual or entity to whom it is 
addressed.
If you have received this email in error please notify the sender. If you are 
not the named addressee you should not disseminate, distribute or copy this 
e-mail. 
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders