<commit_before>////////////////////////////////////////////////////////////////////////////////
//
//  ADOBE SYSTEMS INCORPORATED
//  Copyright 2009 Adobe Systems Incorporated
//  All Rights Reserved.
//
//  NOTICE: Adobe permits you to use, modify, and distribute this file
//  in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////


package spark.components
{

import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import flash.display.InteractiveObject;
import flash.events.Event;

import mx.core.IVisualElement;

/**
 *  The VideoScrubBar class is a video scrubbar/timeline that can show the
 *  current playHead, the amount previously played, and the buffered video.  
 *  
 *  @langversion 3.0
 *  @playerversion Flash 10
 *  @playerversion AIR 1.5
 *  @productversion Flex 4
 */  
public class VideoPlayerScrubBar extends HSlider
{
    
    //--------------------------------------------------------------------------
    //
    //  Constructor
    //
    //--------------------------------------------------------------------------

    /**
     *  Constructor. 
     *  
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 1.5
     *  @productversion Flex 4
     */
    public function VideoPlayerScrubBar()
    {
        super();
        
        dataTipFormatFunction = formatTimeValue;
    }
    
    //--------------------------------------------------------------------------
    //
    //  Skin Parts
    //
    //--------------------------------------------------------------------------
    
    [SkinPart(required="false")]
    
    /**
     *  An optional skin part for the area on the track 
     *  representing the video that's been played.
     *  
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 1.5
     *  @productversion Flex 4
     */
    public var playedArea:IVisualElement;
    
    [SkinPart(required="false")]
    
    /**
     *  An optional skin part for the area on the track 
     *  representing the buffered video.
     *  
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 1.5
     *  @productversion Flex 4
     */
    public var bufferedArea:IVisualElement;
    
    //--------------------------------------------------------------------------
    //
    // Properties
    //
    //--------------------------------------------------------------------------
    
    //--------------------------------- 
    // bufferedValue
    //---------------------------------
    
    private var _bufferedValue:Number;
    
    /**
     *  The value of the video that's been buferred in.  This property 
     *  should be greater than value and less than maximum.
     *  
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 1.5
     *  @productversion Flex 4
     */
    public function get bufferedValue():Number
    {
        return _bufferedValue;
    }
    
    /**
     *  @private
     */
    public function set bufferedValue(value:Number):void
    {
        if (value == _bufferedValue)
            return;
        
        _bufferedValue = value;
        invalidateDisplayList();
    }

    //--------------------------------------------------------------------------
    //
    // Methods
    //
    //--------------------------------------------------------------------------
    
    /**
     *  @private
     */
    override protected function partAdded(partName:String, instance:Object):void
    {
        super.partAdded(partName, instance);
        
        if (instance == playedArea)
        {
            if (playedArea is InteractiveObject)
                InteractiveObject(playedArea).mouseEnabled = false;
            if (playedArea is DisplayObjectContainer)
                DisplayObjectContainer(playedArea).mouseChildren = false;
            
            invalidateDisplayList();
        }
        else if (instance == bufferedArea)
        {
            if (bufferedArea is InteractiveObject)
                InteractiveObject(bufferedArea).mouseEnabled = false;
            if (bufferedArea is DisplayObjectContainer)
                DisplayObjectContainer(bufferedArea).mouseChildren = false;
            
            invalidateDisplayList();
        }
    }
    
    /**
     *  @private
     */
    override protected function completeTrackLayout():void
    {
        super.completeTrackLayout();
        sizeBufferedArea(valueToPosition(bufferedValue) + thumbSize);
        sizePlayedArea(valueToPosition(value) + thumbSize);
    }
    
    /**
     *  Sets the size of the buffered area
     *
     *  @param bufferedAreaSize The new size of the buffered area
     *  
     *  @langversion 3.0<commit_msg>Transferred from the Adobe Open Source Subversion Repository<commit_after>////////////////////////////////////////////////////////////////////////////////
//
//  ADOBE SYSTEMS INCORPORATED
//  Copyright 2009 Adobe Systems Incorporated
//  All Rights Reserved.
//
//  NOTICE: Adobe permits you to use, modify, and distribute this file
//  in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////


package spark.components
{

import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import flash.display.InteractiveObject;
import flash.events.Event;

import mx.core.IVisualElement;

/**
 *  The VideoScrubBar class is a video scrubbar/timeline that can show the
 *  current playHead, the amount previously played, and the buffered video.  
 *  
 *  @langversion 3.0
 *  @playerversion Flash 10
 *  @playerversion AIR 1.5
 *  @productversion Flex 4
 */  
public class VideoPlayerScrubBar extends HSlider
{
    
    //--------------------------------------------------------------------------
    //
    //  Constructor
    //
    //--------------------------------------------------------------------------

    /**
     *  Constructor. 
     *  
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 1.5
     *  @productversion Flex 4
     */
    public function VideoPlayerScrubBar()
    {
        super();
        
        dataTipFormatFunction = formatTimeValue;
    }
    
    //--------------------------------------------------------------------------
    //
    //  Skin Parts
    //
    //--------------------------------------------------------------------------
    
    [SkinPart(required="false")]
    
    /**
     *  An optional skin part for the area on the track 
     *  representing the video that's been played.
     *  
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 1.5
     *  @productversion Flex 4
     */
    public var playedArea:IVisualElement;
    
    [SkinPart(required="false")]
    
    /**
     *  An optional skin part for the area on the track 
     *  representing the buffered video.
     *  
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 1.5
     *  @productversion Flex 4
     */
    public var bufferedArea:IVisualElement;
    
    //--------------------------------------------------------------------------
    //
    // Properties
    //
    //--------------------------------------------------------------------------
    
    //--------------------------------- 
    // bufferedValue
    //---------------------------------
    
    private var _bufferedRange:Array;
    
    /**
     *  The range of values that are currently in the buffer.  The first value 
     *  the array indicates the starting buffered value.  The second value 
     *  indicates the end of buffered in video.
     *  
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 1.5
     *  @productversion Flex 4
     */
    public function get bufferedRange():Array
    {
        return _bufferedRange;
    }
    
    /**
     *  @private
     */
    public function set bufferedRange(value:Array):void
    {
        if (value == _bufferedRange)
            return;
        
        _bufferedRange = value;
        invalidateDisplayList();
    }

    //--------------------------------------------------------------------------
    //
    // Methods
    //
    //--------------------------------------------------------------------------
    
    /**
     *  @private
     */
    override protected function partAdded(partName:String, instance:Object):void
    {
        super.partAdded(partName, instance);
        
        if (instance == playedArea)
        {
            if (playedArea is InteractiveObject)
                InteractiveObject(playedArea).mouseEnabled = false;
            if (playedArea is DisplayObjectContainer)
                DisplayObjectContainer(playedArea).mouseChildren = false;
            
            invalidateDisplayList();
        }
        else if (instance == bufferedArea)
        {
            if (bufferedArea is InteractiveObject)
                InteractiveObject(bufferedArea).mouseEnabled = false;
            if (bufferedArea is DisplayObjectContainer)
                DisplayObjectContainer(bufferedArea).mouseChildren = false;
            
            invalidateDisplayList();
        }
    }
    
    /**
     *  @private
     */
    override protected function completeTrackLayout():void
    {
        super.completeTrackLayout();
        sizeBufferedArea(valueToPosition(bufferedRange[1]) + thumbSize);
        sizePlayedArea(valueToPosition(value) + thumbSize);
    }
    
    /**
     *  Sets the size of the buffered area
     *
     *  @param bufferedAreaSize The new size of the buffered area
     *  
     *  @langversion 3.0
{'fraction_non_alphanumeric': 0.2392437404190087, 'fraction_numerical': 0.00848237097598365, 'mean_word_length': 1.179510022271715, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '680327', 'n_tokens_mistral': 2444, 'n_tokens_neox': 2276, 'n_words': 592}