sample

Add to Favourites
Post to:

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) } } ---------------------------------------------------------------------------------------------------------------------

Comments

Want to learn?

Sign up and browse through relevant courses.

Name:
Your Email:
Password:
Country:
Contact no:


Area code Number
Subjects you are interested in:
Word verification: (Enter the text as in image)


Sign Up Already a member? Sign In
I agree to WizIQ's User Agreement & Privacy Policy
7 Followers

Your Facebook Friends on WizIQ

Give live classes, create & sell online courses

Try it free Plans & Pricing

Connect