Changeset 897


Ignore:
Timestamp:
03/11/10 17:24:48 (3 years ago)
Author:
pablo
Message:
Location:
trunk/fl5
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/fl5/player.xml

    r885 r897  
    9494        <flashvar type="select"> 
    9595            <name>dock</name> 
    96             <default>false</default> 
     96            <default>true</default> 
    9797            <description>Set this to true to show the dock with large buttons in the top right of the player. Available since 4.5.</description> 
    9898            <select> 
  • trunk/fl5/src/com/longtailvideo/jwplayer/player/PlayerVersion.as

    r887 r897  
    33         
    44        public class PlayerVersion { 
    5                 protected static var _version:String = "5.1.887"; 
     5                protected static var _version:String = "5.1.897"; 
    66                 
    77                public static function get version():String { 
  • trunk/fl5/src/com/longtailvideo/jwplayer/view/components/DisplayComponent.as

    r826 r897  
    88        import com.longtailvideo.jwplayer.utils.Draw; 
    99        import com.longtailvideo.jwplayer.view.interfaces.IDisplayComponent; 
    10         import com.longtailvideo.jwplayer.view.skins.SWFSkin; 
     10        import com.longtailvideo.jwplayer.view.skins.PNGSkin; 
    1111         
    1212        import flash.display.Bitmap; 
    1313        import flash.display.DisplayObject; 
    14         import flash.display.DisplayObjectContainer; 
    1514        import flash.display.MovieClip; 
    1615        import flash.display.Sprite; 
     
    8584                 
    8685                 
     86                /** 
     87                 * Takes in an icon from a PNG skin and rearranges its children so that it's centered around 0, 0  
     88                 */ 
     89                protected function centerIcon(icon:Sprite):void { 
     90                        if (icon && icon.getChildAt(0) is Bitmap) { 
     91                                icon.getChildAt(0).x = -Math.round(icon.getChildAt(0).width)/2; 
     92                                icon.getChildAt(0).y = -Math.round(icon.getChildAt(0).height)/2; 
     93                        } 
     94                } 
     95                 
    8796                protected function setupIcon(name:String):void { 
    88                         var back:Sprite = getSkinElement('background') as Sprite; 
    8997                        var icon:Sprite = getSkinElement(name + 'Icon') as Sprite; 
    90                         if (back) { 
    91                                 back.x = 0; 
    92                                 back.y = 0; 
    93                                 back.addChild(icon); 
    94                                 icon.x = (back.width - icon.width) / 2; 
    95                                 icon.y = (back.height - icon.height) / 2; 
    96                                 _icons[name] = back; 
    97                         } else { 
    98                                 _icons[name] = icon; 
    99                         } 
     98                        if (_player.skin is PNGSkin) centerIcon(icon); 
     99                         
    100100                        if (name == "buffer") { 
    101                                 try { 
    102                                         if (_icons[name] is MovieClip && (_icons[name] as MovieClip).totalFrames > 1) { 
    103                                                 // Buffer is already animated; no need to rotate. 
    104                                                 _rotate = false; 
    105                                         } else { 
    106                                                 _bufferIcon = (_icons[name] as DisplayObjectContainer).getChildAt((_icons[name] as DisplayObjectContainer).numChildren - 1) as Sprite; 
    107                                                 _bufferIcon.getChildAt(0).x = Math.round(_bufferIcon.getChildAt(0).width / -2); 
    108                                                 _bufferIcon.getChildAt(0).y = Math.round(_bufferIcon.getChildAt(0).height / -2); 
    109                                                 _bufferIcon.x = back.width / 2 ; 
    110                                                 _bufferIcon.y = back.height - icon.height; 
     101                                if (icon is MovieClip && (icon as MovieClip).totalFrames > 1) { 
     102                                        // Buffer is already animated; no need to rotate. 
     103                                        _rotate = false; 
     104                                } else { 
     105                                        try { 
     106                                                _bufferIcon = icon; 
    111107                                                var bufferBitmap:Bitmap = _bufferIcon.getChildByName('bitmap') as Bitmap; 
    112108                                                if (bufferBitmap) { 
    113109                                                        Draw.smooth(bufferBitmap); 
    114110                                                } 
     111                                        } catch (e:Error) { 
     112                                                _rotate = false; 
    115113                                        } 
    116                                 } catch (err:Error){ 
    117                                         _rotate = false;         
    118114                                } 
    119115                        } 
     116                         
     117                        var back:Sprite = getSkinElement('background') as Sprite; 
     118 
     119                        if (back) { 
     120                                if (_player.skin is PNGSkin) centerIcon(back); 
     121                                back.addChild(icon); 
     122                                back.x = back.y = icon.x = icon.y = 0; 
     123                                _icons[name] = back; 
     124                        } else { 
     125                                _icons[name] = icon; 
     126                        } 
     127 
    120128                } 
    121129                 
     
    144152                 
    145153                private function positionIcon():void { 
    146                         if (_player.skin is SWFSkin) { 
    147                                 // SWF skins' display icons have centered origins 
    148                                 icon.x = background.scaleX / 2; 
    149                                 icon.y = background.scaleY / 2; 
    150                         } else { 
    151                                 icon.x = (background.scaleX - icon.width) / 2; 
    152                                 icon.y = (background.scaleY - icon.height) / 2; 
    153                         } 
     154                        icon.x = background.scaleX / 2; 
     155                        icon.y = background.scaleY / 2; 
    154156                } 
    155157                 
     
    177179                                text.x = (background.scaleX - text.textWidth) / 2; 
    178180                                if (contains(icon)) { 
    179                                         if (_player.skin is SWFSkin) { 
    180                                                 text.y = icon.y + (icon.height/2) + 10; 
    181                                         } else { 
    182                                                 text.y = icon.y + icon.height + 10; 
    183                                         } 
     181                                        text.y = icon.y + (icon.height/2) + 10; 
    184182                                } else { 
    185183                                        text.y = (background.scaleY - text.textHeight) / 2; 
     
    193191                protected function setDisplay(displayIcon:DisplayObject, displayText:String = null):void { 
    194192                        setIcon(displayIcon); 
    195                         setText(displayText ? displayText : text.text); 
     193                        setText(displayText != null ? displayText : text.text); 
    196194                } 
    197195                 
    198196                 
    199197                protected function clearDisplay():void { 
    200                         setDisplay(null, null); 
     198                        setDisplay(null, ''); 
    201199                } 
    202200                 
     
    207205                        switch (player.state) { 
    208206                                case PlayerState.BUFFERING: 
    209                                         setDisplay(_icons['buffer']); 
     207                                        setDisplay(_icons['buffer'], ''); 
    210208                                        if (_rotate){ 
    211209                                                startRotation(); 
     
    236234                 
    237235                protected function updateRotation():void { 
    238                         if (icon is DisplayObjectContainer) { 
    239                                 _bufferIcon.rotation += 15; 
    240                         } 
     236                        if (_bufferIcon) _bufferIcon.rotation += 15; 
    241237                } 
    242238                 
    243239                 
    244240                protected function clearRotation():void { 
     241                        if (_bufferIcon) _bufferIcon.rotation = 0; 
    245242                        if (_rotateInterval) { 
    246243                                clearInterval(_rotateInterval); 
Note: See TracChangeset for help on using the changeset viewer.