Changeset 897
- Timestamp:
- 03/11/10 17:24:48 (3 years ago)
- Location:
- trunk/fl5
- Files:
-
- 4 edited
-
player.swf (modified) (previous)
-
player.xml (modified) (1 diff)
-
src/com/longtailvideo/jwplayer/player/PlayerVersion.as (modified) (1 diff)
-
src/com/longtailvideo/jwplayer/view/components/DisplayComponent.as (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/fl5/player.xml
r885 r897 94 94 <flashvar type="select"> 95 95 <name>dock</name> 96 <default> false</default>96 <default>true</default> 97 97 <description>Set this to true to show the dock with large buttons in the top right of the player. Available since 4.5.</description> 98 98 <select> -
trunk/fl5/src/com/longtailvideo/jwplayer/player/PlayerVersion.as
r887 r897 3 3 4 4 public class PlayerVersion { 5 protected static var _version:String = "5.1.8 87";5 protected static var _version:String = "5.1.897"; 6 6 7 7 public static function get version():String { -
trunk/fl5/src/com/longtailvideo/jwplayer/view/components/DisplayComponent.as
r826 r897 8 8 import com.longtailvideo.jwplayer.utils.Draw; 9 9 import com.longtailvideo.jwplayer.view.interfaces.IDisplayComponent; 10 import com.longtailvideo.jwplayer.view.skins. SWFSkin;10 import com.longtailvideo.jwplayer.view.skins.PNGSkin; 11 11 12 12 import flash.display.Bitmap; 13 13 import flash.display.DisplayObject; 14 import flash.display.DisplayObjectContainer;15 14 import flash.display.MovieClip; 16 15 import flash.display.Sprite; … … 85 84 86 85 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 87 96 protected function setupIcon(name:String):void { 88 var back:Sprite = getSkinElement('background') as Sprite;89 97 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 100 100 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; 111 107 var bufferBitmap:Bitmap = _bufferIcon.getChildByName('bitmap') as Bitmap; 112 108 if (bufferBitmap) { 113 109 Draw.smooth(bufferBitmap); 114 110 } 111 } catch (e:Error) { 112 _rotate = false; 115 113 } 116 } catch (err:Error){117 _rotate = false;118 114 } 119 115 } 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 120 128 } 121 129 … … 144 152 145 153 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; 154 156 } 155 157 … … 177 179 text.x = (background.scaleX - text.textWidth) / 2; 178 180 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; 184 182 } else { 185 183 text.y = (background.scaleY - text.textHeight) / 2; … … 193 191 protected function setDisplay(displayIcon:DisplayObject, displayText:String = null):void { 194 192 setIcon(displayIcon); 195 setText(displayText ? displayText : text.text);193 setText(displayText != null ? displayText : text.text); 196 194 } 197 195 198 196 199 197 protected function clearDisplay():void { 200 setDisplay(null, null);198 setDisplay(null, ''); 201 199 } 202 200 … … 207 205 switch (player.state) { 208 206 case PlayerState.BUFFERING: 209 setDisplay(_icons['buffer'] );207 setDisplay(_icons['buffer'], ''); 210 208 if (_rotate){ 211 209 startRotation(); … … 236 234 237 235 protected function updateRotation():void { 238 if (icon is DisplayObjectContainer) { 239 _bufferIcon.rotation += 15; 240 } 236 if (_bufferIcon) _bufferIcon.rotation += 15; 241 237 } 242 238 243 239 244 240 protected function clearRotation():void { 241 if (_bufferIcon) _bufferIcon.rotation = 0; 245 242 if (_rotateInterval) { 246 243 clearInterval(_rotateInterval);
Note: See TracChangeset
for help on using the changeset viewer.
