User Tag List

Results 1 to 8 of 8

Thread: Percentage

  1. #1
    No Products Registered

    Join Date
    Jul 2006
    Location
    www.dingdongstudios.co.nr
    Posts
    505
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Percentage

    How would I get the percentage played of a file with the directshow object? I know you can get the current position and total duration. So what would the expression be? I thought: GetPosition( "Direct Show" )/GetDuration( "Direct Show" )*100. But that doesn't seem to work :s

  2. #2
    Clicker Fusion 2.5 DeveloperSWF Export ModuleUnicode Add-on
    Looki's Avatar
    Join Date
    Aug 2006
    Location
    Karlsruhe, Germany
    Posts
    3,739
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: Percentage

    LOL


    I was just crafting a little bit, and I finally got it

    (GetDuration( "Direct Show" )-(GetDuration( "Direct Show" )-GetPosition( "Direct Show" )))/(GetDuration( "Direct Show" )/100)

    There must be an easier way!!!

  3. #3
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module

    Join Date
    Sep 2006
    Location
    Spain
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Percentage

    (GetPosition( "Direct Show" )/GetDuration( "Direct Show" ))*100.

    You were dividing by 100, instead of multiplying by 100.

    Greetings!

  4. #4
    Clicker Fusion 2.5 DeveloperSWF Export ModuleUnicode Add-on
    Looki's Avatar
    Join Date
    Aug 2006
    Location
    Karlsruhe, Germany
    Posts
    3,739
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: Percentage

    But he posted exactly that what you posted. And I tested that, it doesn't work.

  5. #5
    No Products Registered

    Join Date
    Jul 2006
    Location
    Texas
    Posts
    1,225
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Percentage

    For it to work, the counter must be a floating point number. Change the *100 to *100.00 and see if that works.

  6. #6
    No Products Registered

    Join Date
    Sep 2006
    Location
    Malmesbury, UK
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Percentage

    How about...
    (GetPosition( "Direct Show" )*100)/GetDuration( "Direct Show" )

    Plooscva

  7. #7
    No Products Registered

    Join Date
    Aug 2006
    Location
    Westcountry, UK
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Percentage

    They should all work, just that looki's version is rather lengthened.

    PERCENTAGE = VALUE / TOTAL

    because we display percentages as a fraction of 100 then you just x by 100. The problem with doing this after the division is that it creates a decimal number that might be rounded at somestage.

    % = (VALUE*100)/TOTAL

    Gives a vaild percentage.
    Lets have a look at Looki's example:

    [color:green]% = (x-(x-y))/(x/100)[/color]

    We can use a few identities (equations that are always true) to simplify this:

    Firstly,

    (x-(x-y)) == y

    because if x-y = z you can rearrange this to make x-z = y

    [color:green]% = y/(x/100)[/color]

    Secondly,

    y/(x/100) == (y*100)/x

    e.g. 2*100/4 = 200/4 = 50 = 2/0.04 = 2/(4/100)

    ...so basically they're the same thing

  8. #8
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Percentage

    Yes, multiply first rather than after the division (or convert to floating point) to avoid rounding errors.

Similar Threads

  1. How to get the percentage of two counters?
    By Corlen in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 4th April 2012, 06:09 PM
  2. Cannot get percentage?
    By Dynamite in forum Multimedia Fusion 2 - Technical Support
    Replies: 18
    Last Post: 14th May 2010, 01:08 PM
  3. Percentage of Counter
    By Jdsfrog in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 25th October 2008, 03:14 PM
  4. Percentage Question
    By scdlsam in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 22nd April 2007, 04:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •