hi.

i have a viewport for my application and i want to create another smaller 
viewport whose width and height is in the same ratio as the original viewport. 
i'm having trouble calculating it correctly. 

// here's the call to the method that creates the 2nd, smaller viewport
setSubWindowSize(viewportWidth,viewportHeight); // the params are the width and 
height of the original viewport.

public function setSubWindowSize(width:Number,height:Number):Void { 
  
  // calculate ratio of width to height
  var ratio:Number = viewportHeight/viewportWidth;

  var calculatedWidth:Number = ratio*height;
  var calculatedHeight:Number = height;
 }

so, if my original viewport is 300 x 400, then the ratio will be 1.33 but the 
new ratio(calculatedHeight/calculatedWidth) gives 0.75. can anyone see what is 
wrong with my calculations?

any help is very much appreciated. thanks. 

matt.
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to