Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7514819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:36:52+00:00 2026-05-30T00:36:52+00:00

So I have created my vdeo player , but Im havin problems handling different

  • 0

So I have created my vdeo player , but Im havin problems handling different sized videos. How to properly scale videos proportionally?

I get original width and height from metadata object:

        private function onMetaData(newMeta:Object):void
        {           
            _height = newMeta.height;
            _width = newMeta.width;
            scaleProportional();
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T00:36:53+00:00Added an answer on May 30, 2026 at 12:36 am

    1. Proportional factor

    One way to do this is to calculate the proportional factor. It is equal to the width divided by the height:

    var proportions: Number = video.width / video.height;
    

    You can apply that factor to any new width or height you set the video to:

    function scaleProportionalByWidth ( newWidth:Number ) : void {
        video.width = newWidth;
        video.height = newWidth / proportions;
    }
    
    function scaleProportionalByHeight ( newHeight : Number ) : void {
        video.height = newHeight;
        video.width = newHeight * proportions;
    }
    

    2. Scaling factor

    Another way to do it is to find out by which factor to scale the video, then set scaleX and scaleY instead of width and height:

    function scaleProportionalByWidth ( newWidth : Number ) : void {
        scaleProportional ( newWidth, video.width );
    }
    
    function scaleProportionalByHeight ( newHeight : Number ) : void {
        scaleProportional ( newHeight, video.height );
    }
    
    function scaleProportional ( newValue:Number, oldValue : Number ) : void {
        var scale:Number = newValue / oldValue;
        video.scaleX *= scale;
        video.scaleY *= scale;
    }
    

    3. Proportional display object classes

    You can also use the approach in 2. to create a proportional subclass of any DisplayObject by overriding the setters for width, height, scaleXand scaleY to make all scaling proportional:

                                               //  works for Sprite, MovieClip...
    public class ProportionalDisplayObject extends DisplayObject { 
        override public function set width ( width:Number ) : void {
            scaleX = width / super.width;
        }
    
        override public function set height ( height:Number ) : void {
            scaleY = height / super.height;
        }
    
        override public function set scaleX ( scaleX : Number ) : void {
            super.scaleX = super.scaleY = scaleX;
        }
    
        override public function set scaleY ( scaleY : Number ) : void {
            super.scaleY = super.scaleX = scaleY;
        }
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created enemies that chase the player around a game, but there is
I have created a simple web service called TimeServerBean . It's working properly, the
I have created a list. And I need to get the text on the
i have created one jsp file but it doesn't running in any way..!! it
I have created a triangle using canvas but i was wondering if there was
I have created form using ModelForm but its not saving data into database. views.py
I have created a mac application using the WebView. But issue is that webView
I have created a facebook apps. It works fine for me. But my problem
i have created a custom UITableViewCell , but when I dequeue the cell, sometimes
Have created a c++ implementation of the Hough transform for detecting lines in images.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.