Follow JR On...

Follow JR on FlickrFollow JR on LinkedInFollow JR on YouTubeFollow JR on Google+Follow JR on FacebookFollow JR on Twitter

How to Disable FLVPlayback SeekBar Control in AS3

I ran across a problem where I needed to disable a seek bar/scrubber bar in a video player based on a FLVPlayback component in Actionscript 3 using on of Adobe's provided contol skins. A Google search gave me solutions that worked for people in AS2, but I found many with the same problem an me in AS3. The best solution I found was to change the skin source code to allow for disabling the bar, but I really didn't want to do this and have another swf to maintain, so I finally figured out my own solution, shown below.

This code, in my player extended from FLVPlayback, checks to see if the seekBar exists, and if it does it finds and hides the SeekBarHandle and the SeekBarHit via some accessible properties of the seekBar.

if (this.seekBar)
{
    for each (var __obj:Object in (this.seekBar as Object).uiMgr.ctrlDataDict)
    {
        if (__obj.ctrl.toString() == "[object SeekBar]")
        {
            __obj.handle_mc.visible = false;
            __obj.hit_mc.visible = false;
        }
    }
}

This seems to work fine for me, and I'm able to restore the seekBar using the same code and setting the visiblity to true.

Please let me know if you find a more elegant solution.