Jump to content
Search Community

Volume slider for VideoLoader?

mhulse test
Moderator Tag

Recommended Posts

Hello,

 

This is kinda a tweener question, but I am using the VideoLoader/LoaderMax class, so hopefully this is the right forum to ask this question...

 

Just curious if someone could give me a kick in the right direction here.

 

Basically, I have a mute/un-mute button which fades in/out the video audio upon toggle/click. This works great!

 

Now, I would like to have a volume slider where folks can control the level of audio when it is un-muted.

 

Can anyone share some code and/or kick me in the right direction here? I am just not sure of the best way to tie my graphics to the video volume level (in fact, this would be a new experience for me, so any tips ya'll could provide would be great!)

 

Many thanks in advance!

 

Cheers,

Micky

Link to comment
Share on other sites

You could use a Slider or if you're doing custom graphics, just add a MOUSE_DOWN event listener on your knob and inside that handler, do a startDrag() on it and set the bounds parameter so that it can only be dragged in the area you define (up and down or left and right depending on your graphics). Add a MOUSE_MOVE listener that simply figures out the ratio of where the knob currently is compared to its maximum, like if the graphic can be dragged from a y coordinate of 200 to 100 where 100 is maximum volume and 200 is minimum (remember, 200 is lower vertically), if the knob is at 175 that would represent a volume of 0.25. 150 would be 0.5, and so on.

 

Basically the volume would be 1 - (maximumY - minimumY) / (knobY - minimumY)

 

Hope that gives you a nudge in the right direction. There's a free tutorial that has a custom scrubber for the video (not volume, but the concept is similar) at http://active.tutsplus.com/tutorials/ac ... e-premium/

Link to comment
Share on other sites

Thank you Greensock!!!!!

 

Very helpful information. I really appreciate it!

 

If I create anything worth sharing, I will post my code back here. :)

 

[ot]

 

As soon as I have the extra cash I plan on buying the Shockingly Green membership. Your code is just amazing!

 

I was thinking this morning... And this might sound completely silly, but you should nickname your framework "fQuery" because its like jQuery for Flash!

 

[/ot]

 

Thanks a billion!

 

Cheers,

Micky

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...