method to calculate the aspect ratio first time
private function getAspectRatio(i:int, k:int):String{
var ratio:String = "";
var hcf:int = 1;
var counter:int = 1;
while(counter <= Math.min(i,k)){
if((i % counter == 0) && (k % counter == 0)){
hcf = counter;
}
counter++;
}
ratio = (i / hcf ) + ":" + ( k / hcf);
return ratio;
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
To calculate the proportion on resize
{
var arrAspectRatio:Array = null;
if(videoAspectRatio != null)
{
//Alert.show("aspect ratio fired");
arrAspectRatio = videoAspectRatio.split(":");
var tempHt:Number //= videoHeightRatio * videoPlayerBox.height;
var tempWdth:Number = videoPlayerBox.width//= videoWidthRatio * videoPlayerBox.width;
var ratioValue:Number = arrAspectRatio[1] / arrAspectRatio[0];
tempHt = ratioValue * tempWdth;
if(tempHt > videoPlayerBox.height)
{
tempHt = videoPlayerBox.height;
tempWdth = tempHt / ratioValue;
}
if(videoType == "vPlayer" && videoPlayer != null)
{
if(videoPlayer.video != null)
{
videoPlayer.video.height = tempHt;
videoPlayer.video.width = tempWdth;
}
}
else
{
mediaPlayer.height = tempHt;
mediaPlayer.width = tempWdth;
}
var tempBoard:ExtWrittingBoard = writeBoard; //(e.currentTarget.getChildByName(currentWriteBoardName) as ExtWrittingBoard);
tempBoard.width = tempWdth;
tempBoard.height = tempHt;
tempBoard.x = (videoPlayerBox.width/2-tempWdth/2);
tempBoard.y = (videoPlayerBox.height/2-tempHt/2);
//Alert.show("resizing " + addingFromFso + " " + tempHt + " " + tempWdth + " " + videoPlayerBox.width + " " +videoPlayerBox.height)
}
}
---------------------------------------------------------------------------------------------------------------------
Presentation Transcript
Your Facebook Friends on WizIQ