| 1 | package com.longtailvideo.jwplayer.view.components { |
|---|
| 2 | import com.longtailvideo.jwplayer.events.MediaEvent; |
|---|
| 3 | import com.longtailvideo.jwplayer.events.PlayerEvent; |
|---|
| 4 | import com.longtailvideo.jwplayer.events.PlayerStateEvent; |
|---|
| 5 | import com.longtailvideo.jwplayer.events.PlaylistEvent; |
|---|
| 6 | import com.longtailvideo.jwplayer.events.ViewEvent; |
|---|
| 7 | import com.longtailvideo.jwplayer.player.IPlayer; |
|---|
| 8 | import com.longtailvideo.jwplayer.player.PlayerState; |
|---|
| 9 | import com.longtailvideo.jwplayer.plugins.PluginConfig; |
|---|
| 10 | import com.longtailvideo.jwplayer.utils.Strings; |
|---|
| 11 | import com.longtailvideo.jwplayer.view.interfaces.IControlbarComponent; |
|---|
| 12 | |
|---|
| 13 | import flash.display.Bitmap; |
|---|
| 14 | import flash.display.DisplayObject; |
|---|
| 15 | import flash.display.MovieClip; |
|---|
| 16 | import flash.display.Sprite; |
|---|
| 17 | import flash.events.MouseEvent; |
|---|
| 18 | import flash.geom.ColorTransform; |
|---|
| 19 | import flash.text.TextField; |
|---|
| 20 | import flash.text.TextFieldAutoSize; |
|---|
| 21 | import flash.text.TextFormat; |
|---|
| 22 | import flash.ui.Mouse; |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | /** |
|---|
| 26 | * Sent when the user interface requests that the player play the currently loaded media |
|---|
| 27 | * |
|---|
| 28 | * @eventType com.longtailvideo.jwplayer.events.ViewEvent.JWPLAYER_VIEW_PLAY |
|---|
| 29 | */ |
|---|
| 30 | [Event(name="jwPlayerViewPlay", type="com.longtailvideo.jwplayer.events.ViewEvent")] |
|---|
| 31 | /** |
|---|
| 32 | * Sent when the user interface requests that the player pause the currently playing media |
|---|
| 33 | * |
|---|
| 34 | * @eventType com.longtailvideo.jwplayer.events.ViewEvent.JWPLAYER_VIEW_PAUSE |
|---|
| 35 | */ |
|---|
| 36 | [Event(name="jwPlayerViewPause", type="com.longtailvideo.jwplayer.events.ViewEvent")] |
|---|
| 37 | /** |
|---|
| 38 | * Sent when the user interface requests that the player stop the currently playing media |
|---|
| 39 | * |
|---|
| 40 | * @eventType com.longtailvideo.jwplayer.events.ViewEvent.JWPLAYER_VIEW_STOP |
|---|
| 41 | */ |
|---|
| 42 | [Event(name="jwPlayerViewStop", type="com.longtailvideo.jwplayer.events.ViewEvent")] |
|---|
| 43 | /** |
|---|
| 44 | * Sent when the user interface requests that the player play the next item in its playlist |
|---|
| 45 | * |
|---|
| 46 | * @eventType com.longtailvideo.jwplayer.events.ViewEvent.JWPLAYER_VIEW_NEXT |
|---|
| 47 | */ |
|---|
| 48 | [Event(name="jwPlayerViewNext", type="com.longtailvideo.jwplayer.events.ViewEvent")] |
|---|
| 49 | /** |
|---|
| 50 | * Sent when the user interface requests that the player play the previous item in its playlist |
|---|
| 51 | * |
|---|
| 52 | * @eventType com.longtailvideo.jwplayer.events.ViewEvent.JWPLAYER_VIEW_PREV |
|---|
| 53 | */ |
|---|
| 54 | [Event(name="jwPlayerViewPrev", type="com.longtailvideo.jwplayer.events.ViewEvent")] |
|---|
| 55 | /** |
|---|
| 56 | * Sent when the user interface requests that the player navigate to the playlist item's <code>link</code> property |
|---|
| 57 | * |
|---|
| 58 | * @eventType com.longtailvideo.jwplayer.events.ViewEvent.JWPLAYER_VIEW_LINK |
|---|
| 59 | */ |
|---|
| 60 | [Event(name="jwPlayerViewLink", type="com.longtailvideo.jwplayer.events.ViewEvent")] |
|---|
| 61 | /** |
|---|
| 62 | * |
|---|
| 63 | * |
|---|
| 64 | * @eventType com.longtailvideo.jwplayer.events.ViewEvent.JWPLAYER_VIEW_MUTE |
|---|
| 65 | */ |
|---|
| 66 | [Event(name="jwPlayerViewMute", type="com.longtailvideo.jwplayer.events.ViewEvent")] |
|---|
| 67 | /** |
|---|
| 68 | * |
|---|
| 69 | * |
|---|
| 70 | * @eventType com.longtailvideo.jwplayer.events.ViewEvent.JWPLAYER_VIEW_FULLSCREEN |
|---|
| 71 | */ |
|---|
| 72 | [Event(name="jwPlayerViewFullscreen", type="com.longtailvideo.jwplayer.events.ViewEvent")] |
|---|
| 73 | /** |
|---|
| 74 | * |
|---|
| 75 | * |
|---|
| 76 | * @eventType com.longtailvideo.jwplayer.events.ViewEvent.JWPLAYER_VIEW_VOLUME |
|---|
| 77 | */ |
|---|
| 78 | [Event(name="jwPlayerViewVolume", type="com.longtailvideo.jwplayer.events.ViewEvent")] |
|---|
| 79 | /** |
|---|
| 80 | * |
|---|
| 81 | * |
|---|
| 82 | * @eventType com.longtailvideo.jwplayer.events.ViewEvent.JWPLAYER_VIEW_SEEK |
|---|
| 83 | */ |
|---|
| 84 | [Event(name="jwPlayerViewSeek", type="com.longtailvideo.jwplayer.events.ViewEvent")] |
|---|
| 85 | public class ControlbarComponent extends CoreComponent implements IControlbarComponent { |
|---|
| 86 | protected var _buttons:Object = {}; |
|---|
| 87 | protected var _dividers:Array; |
|---|
| 88 | protected var _defaultLayout:String = "[play|stop|prev|next|elapsed][time][duration|fullscreen|mute volume]"; |
|---|
| 89 | protected var _currentLayout:String; |
|---|
| 90 | protected var _layoutManager:ControlbarLayoutManager; |
|---|
| 91 | protected var _width:Number; |
|---|
| 92 | protected var _height:Number; |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | public function ControlbarComponent(player:IPlayer) { |
|---|
| 96 | super(player); |
|---|
| 97 | _layoutManager = new ControlbarLayoutManager(this); |
|---|
| 98 | _dividers = []; |
|---|
| 99 | setupBackground(); |
|---|
| 100 | setupDefaultButtons(); |
|---|
| 101 | addEventListeners(); |
|---|
| 102 | updateControlbarState(); |
|---|
| 103 | } |
|---|
| 104 | |
|---|
| 105 | |
|---|
| 106 | private function addEventListeners():void { |
|---|
| 107 | player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, playlistHandler); |
|---|
| 108 | player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_UPDATED, playlistHandler); |
|---|
| 109 | player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, playlistHandler); |
|---|
| 110 | player.addEventListener(PlayerStateEvent.JWPLAYER_PLAYER_STATE, stateHandler); |
|---|
| 111 | player.addEventListener(MediaEvent.JWPLAYER_MEDIA_MUTE, stateHandler); |
|---|
| 112 | player.addEventListener(MediaEvent.JWPLAYER_MEDIA_VOLUME, stateHandler); |
|---|
| 113 | player.addEventListener(MediaEvent.JWPLAYER_MEDIA_BUFFER, mediaHandler); |
|---|
| 114 | player.addEventListener(MediaEvent.JWPLAYER_MEDIA_TIME, mediaHandler); |
|---|
| 115 | } |
|---|
| 116 | |
|---|
| 117 | |
|---|
| 118 | private function playlistHandler(evt:PlaylistEvent):void { |
|---|
| 119 | resetSlider(); |
|---|
| 120 | updateControlbarState(); |
|---|
| 121 | redraw(); |
|---|
| 122 | } |
|---|
| 123 | |
|---|
| 124 | |
|---|
| 125 | private function resetSlider():void { |
|---|
| 126 | var scrubber:Slider = getButton('time') as Slider; |
|---|
| 127 | if (scrubber) { |
|---|
| 128 | scrubber.reset(); |
|---|
| 129 | } |
|---|
| 130 | } |
|---|
| 131 | |
|---|
| 132 | |
|---|
| 133 | private function stateHandler(evt:PlayerEvent):void { |
|---|
| 134 | updateControlbarState(); |
|---|
| 135 | redraw(); |
|---|
| 136 | } |
|---|
| 137 | |
|---|
| 138 | |
|---|
| 139 | private function updateControlbarState():void { |
|---|
| 140 | var newLayout:String = _defaultLayout; |
|---|
| 141 | if (player.state == PlayerState.PLAYING) { |
|---|
| 142 | newLayout = newLayout.replace('play', 'pause'); |
|---|
| 143 | hideButton('play'); |
|---|
| 144 | } else { |
|---|
| 145 | hideButton('pause'); |
|---|
| 146 | } |
|---|
| 147 | if (player.playlist.length <= 1) { |
|---|
| 148 | newLayout = newLayout.replace("|prev|next", ""); |
|---|
| 149 | hideButton('prev'); |
|---|
| 150 | hideButton('next'); |
|---|
| 151 | } |
|---|
| 152 | if (player.mute) { |
|---|
| 153 | newLayout = newLayout.replace("mute", "unmute"); |
|---|
| 154 | hideButton("mute"); |
|---|
| 155 | } else { |
|---|
| 156 | hideButton("unmute"); |
|---|
| 157 | } |
|---|
| 158 | if (player.fullscreen) { |
|---|
| 159 | newLayout = newLayout.replace("fullscreen", "normalscreen"); |
|---|
| 160 | hideButton("fullscreen"); |
|---|
| 161 | } else { |
|---|
| 162 | hideButton("normalscreen"); |
|---|
| 163 | } |
|---|
| 164 | _currentLayout = removeInactive(newLayout); |
|---|
| 165 | } |
|---|
| 166 | |
|---|
| 167 | |
|---|
| 168 | private function removeInactive(layout:String):String { |
|---|
| 169 | var buttons:Array = _defaultLayout.match(/\W*([A-Za-z0-9]+?)\W/g); |
|---|
| 170 | for (var i:Number = 0; i < buttons.length; i++){ |
|---|
| 171 | var button:String = (buttons[i] as String).replace(/\W/g,""); |
|---|
| 172 | if (!_buttons[button]) { |
|---|
| 173 | layout = layout.replace(button,""); |
|---|
| 174 | layout = layout.replace("||", "|"); |
|---|
| 175 | } |
|---|
| 176 | } |
|---|
| 177 | return layout; |
|---|
| 178 | } |
|---|
| 179 | |
|---|
| 180 | private function mediaHandler(evt:MediaEvent):void { |
|---|
| 181 | var scrubber:Slider = getButton('time') as Slider; |
|---|
| 182 | switch (evt.type) { |
|---|
| 183 | case MediaEvent.JWPLAYER_MEDIA_BUFFER: |
|---|
| 184 | setTime(evt.position, evt.duration); |
|---|
| 185 | if (scrubber) { |
|---|
| 186 | scrubber.setProgress(evt.position); |
|---|
| 187 | scrubber.setBuffer(evt.bufferPercent); |
|---|
| 188 | } |
|---|
| 189 | break; |
|---|
| 190 | case MediaEvent.JWPLAYER_MEDIA_TIME: |
|---|
| 191 | setTime(evt.position, evt.duration); |
|---|
| 192 | if (scrubber) { |
|---|
| 193 | scrubber.setProgress(evt.position); |
|---|
| 194 | scrubber.setBuffer(evt.bufferPercent); |
|---|
| 195 | } |
|---|
| 196 | break; |
|---|
| 197 | default: |
|---|
| 198 | scrubber.reset(); |
|---|
| 199 | break; |
|---|
| 200 | } |
|---|
| 201 | } |
|---|
| 202 | |
|---|
| 203 | |
|---|
| 204 | private function setTime(position:Number, duration:Number):void { |
|---|
| 205 | if (duration >= 0) { |
|---|
| 206 | var elapsedText:TextField = getButton('elapsed') as TextField; |
|---|
| 207 | var durationField:TextField = getButton('duration') as TextField; |
|---|
| 208 | elapsedText.text = Strings.digits(position); |
|---|
| 209 | durationField.text = Strings.digits(duration); |
|---|
| 210 | } |
|---|
| 211 | } |
|---|
| 212 | |
|---|
| 213 | |
|---|
| 214 | private function setupBackground():void { |
|---|
| 215 | var back:DisplayObject = getSkinElement("controlbar", "back"); |
|---|
| 216 | if (!back) { |
|---|
| 217 | var newBackground:Sprite = new Sprite(); |
|---|
| 218 | newBackground.name = "background"; |
|---|
| 219 | newBackground.graphics.beginFill(0, 1); |
|---|
| 220 | newBackground.graphics.drawRect(0, 0, 1, 1); |
|---|
| 221 | newBackground.graphics.endFill(); |
|---|
| 222 | back = newBackground as DisplayObject; |
|---|
| 223 | } else if (back is Bitmap) { |
|---|
| 224 | var backContainer:Sprite = new Sprite(); |
|---|
| 225 | backContainer.addChild(back); |
|---|
| 226 | back = backContainer as DisplayObject; |
|---|
| 227 | } |
|---|
| 228 | if (player.config.backcolor) { |
|---|
| 229 | var colorTransform:ColorTransform = new ColorTransform(); |
|---|
| 230 | colorTransform.color = player.config.backcolor.color; |
|---|
| 231 | back.transform.colorTransform = colorTransform; |
|---|
| 232 | } |
|---|
| 233 | back.x = 0; |
|---|
| 234 | back.y = 0; |
|---|
| 235 | _buttons['background'] = back; |
|---|
| 236 | addChildAt(back, 0); |
|---|
| 237 | player.config.pluginConfig("controlbar")['size'] = back.height; |
|---|
| 238 | _height = back.height; |
|---|
| 239 | if (getSkinElement("controlbar", "shade")) { |
|---|
| 240 | var shade:DisplayObject = getSkinElement("controlbar", "shade"); |
|---|
| 241 | if (shade is Bitmap) { |
|---|
| 242 | var shadeContainer:Sprite = new Sprite(); |
|---|
| 243 | shadeContainer.addChild(shade); |
|---|
| 244 | shade = shadeContainer as DisplayObject; |
|---|
| 245 | } |
|---|
| 246 | shade.x = 0; |
|---|
| 247 | shade.y = 0; |
|---|
| 248 | _buttons['shade'] = shade; |
|---|
| 249 | addChildAt(shade, 1); |
|---|
| 250 | } |
|---|
| 251 | } |
|---|
| 252 | |
|---|
| 253 | |
|---|
| 254 | private function setupDefaultButtons():void { |
|---|
| 255 | addComponentButton('play', 'Play', ViewEvent.JWPLAYER_VIEW_PLAY); |
|---|
| 256 | addComponentButton('pause', 'Pause', ViewEvent.JWPLAYER_VIEW_PAUSE); |
|---|
| 257 | addComponentButton('prev', 'Previous', ViewEvent.JWPLAYER_VIEW_PREV); |
|---|
| 258 | addComponentButton('next', 'Next', ViewEvent.JWPLAYER_VIEW_NEXT); |
|---|
| 259 | addComponentButton('stop', 'Stop', ViewEvent.JWPLAYER_VIEW_STOP); |
|---|
| 260 | addComponentButton('fullscreen', 'Fullscreen', ViewEvent.JWPLAYER_VIEW_FULLSCREEN, true); |
|---|
| 261 | addComponentButton('normalscreen', 'Normalscreen', ViewEvent.JWPLAYER_VIEW_FULLSCREEN, false); |
|---|
| 262 | addComponentButton('unmute', 'Mute', ViewEvent.JWPLAYER_VIEW_MUTE, false); |
|---|
| 263 | addComponentButton('mute', 'Unmute', ViewEvent.JWPLAYER_VIEW_MUTE, true); |
|---|
| 264 | addSlider('time', Slider.HORIZONTAL, ViewEvent.JWPLAYER_VIEW_CLICK, seekHandler); |
|---|
| 265 | addSlider('volume', Slider.HORIZONTAL, ViewEvent.JWPLAYER_VIEW_CLICK, seekHandler); |
|---|
| 266 | addTextField('elapsed', getFont(getSkinElement("controlbar", "elapsedText") as TextField)); |
|---|
| 267 | addTextField('duration', getFont(getSkinElement("controlbar", "totalText") as TextField)); |
|---|
| 268 | } |
|---|
| 269 | |
|---|
| 270 | |
|---|
| 271 | private function addComponentButton(name:String, text:String, event:String, eventData:* = null):void { |
|---|
| 272 | var button:ComponentButton = new ComponentButton(); |
|---|
| 273 | button.setOutIcon(getSkinElement("controlbar", name + "Button")); |
|---|
| 274 | button.setOverIcon(getSkinElement("controlbar", name + "ButtonOver")); |
|---|
| 275 | button.setBackground(getSkinElement("controlbar", name + "ButtonBack")); |
|---|
| 276 | button.outColor = player.config.lightcolor; |
|---|
| 277 | button.overColor = player.config.backcolor; |
|---|
| 278 | button.clickFunction = function():void { |
|---|
| 279 | forward(new ViewEvent(event, eventData)); |
|---|
| 280 | } |
|---|
| 281 | if (getSkinElement("controlbar", name + "Button") |
|---|
| 282 | || getSkinElement("controlbar", name + "ButtonOver") |
|---|
| 283 | || getSkinElement("controlbar", name + "ButtonBack")) { |
|---|
| 284 | button.init(); |
|---|
| 285 | addButtonDisplayObject(button, name); |
|---|
| 286 | } |
|---|
| 287 | } |
|---|
| 288 | |
|---|
| 289 | |
|---|
| 290 | private function addSlider(name:String, orientation:String, event:String, callback:Function):void { |
|---|
| 291 | var slider:Slider = new Slider(getSkinElement("controlbar", name + "SliderRail"), getSkinElement("controlbar", name + "SliderBuffer"), getSkinElement("controlbar", name + "SliderProgress"), getSkinElement("controlbar", name + "SliderThumb"), orientation); |
|---|
| 292 | slider.addEventListener(event, callback); |
|---|
| 293 | addButtonDisplayObject(slider, name); |
|---|
| 294 | } |
|---|
| 295 | |
|---|
| 296 | |
|---|
| 297 | private function addTextField(name:String, font:String):void { |
|---|
| 298 | var textField:TextField = new TextField(); |
|---|
| 299 | textField.text = '00:00'; |
|---|
| 300 | var textFormat:TextFormat = new TextFormat(); |
|---|
| 301 | textFormat.font = font; |
|---|
| 302 | textFormat.size = 20; |
|---|
| 303 | textField.setTextFormat(textFormat); |
|---|
| 304 | textField.selectable = false; |
|---|
| 305 | textField.autoSize = TextFieldAutoSize.LEFT; |
|---|
| 306 | textField.name = name; |
|---|
| 307 | addChild(textField); |
|---|
| 308 | _buttons[name] = textField; |
|---|
| 309 | } |
|---|
| 310 | |
|---|
| 311 | |
|---|
| 312 | private function forward(evt:ViewEvent):void { |
|---|
| 313 | dispatchEvent(evt); |
|---|
| 314 | } |
|---|
| 315 | |
|---|
| 316 | |
|---|
| 317 | private function volumeHandler(evt:ViewEvent):void { |
|---|
| 318 | dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_VOLUME, evt.data)); |
|---|
| 319 | } |
|---|
| 320 | |
|---|
| 321 | |
|---|
| 322 | private function seekHandler(evt:ViewEvent):void { |
|---|
| 323 | var duration:Number = 0; |
|---|
| 324 | try { |
|---|
| 325 | duration = player.playlist.currentItem.duration; |
|---|
| 326 | } catch (err:Error) { |
|---|
| 327 | } |
|---|
| 328 | var percent:Number = Math.round(duration * evt.data); |
|---|
| 329 | dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_SEEK, percent)); |
|---|
| 330 | } |
|---|
| 331 | |
|---|
| 332 | |
|---|
| 333 | public function addButton(icon:DisplayObject, name:String, handler:Function = null):MovieClip { |
|---|
| 334 | _defaultLayout = _defaultLayout.replace("|fullscreen","|"+name+"|fullscreen"); |
|---|
| 335 | return addButtonDisplayObject(icon, name, handler); |
|---|
| 336 | } |
|---|
| 337 | |
|---|
| 338 | private function addButtonDisplayObject(icon:DisplayObject, name:String, handler:Function = null):MovieClip{ |
|---|
| 339 | if (icon) { |
|---|
| 340 | var clipMC:MovieClip = new MovieClip(); |
|---|
| 341 | if (handler != null) { |
|---|
| 342 | clipMC.addEventListener(MouseEvent.CLICK, handler); |
|---|
| 343 | } |
|---|
| 344 | clipMC.name = name; |
|---|
| 345 | clipMC.addChild(icon); |
|---|
| 346 | _buttons[name] = clipMC; |
|---|
| 347 | return clipMC; |
|---|
| 348 | } |
|---|
| 349 | return null; |
|---|
| 350 | } |
|---|
| 351 | |
|---|
| 352 | public function removeButton(name:String):void { |
|---|
| 353 | _buttons[name] = null; |
|---|
| 354 | redraw(); |
|---|
| 355 | } |
|---|
| 356 | |
|---|
| 357 | |
|---|
| 358 | private function hideButton(name:String):void { |
|---|
| 359 | if (_buttons[name]) { |
|---|
| 360 | _buttons[name].visible = false; |
|---|
| 361 | } |
|---|
| 362 | } |
|---|
| 363 | |
|---|
| 364 | |
|---|
| 365 | public function getButton(buttonName:String):DisplayObject { |
|---|
| 366 | if (buttonName == "divider") { |
|---|
| 367 | var divider:DisplayObject = getSkinElement("controlbar", "divider"); |
|---|
| 368 | if (divider) { |
|---|
| 369 | _dividers.push(divider); |
|---|
| 370 | } |
|---|
| 371 | return divider; |
|---|
| 372 | } |
|---|
| 373 | return _buttons[buttonName]; |
|---|
| 374 | } |
|---|
| 375 | |
|---|
| 376 | |
|---|
| 377 | public function resize(width:Number, height:Number):void { |
|---|
| 378 | _width = width; |
|---|
| 379 | var wid:Number = width; |
|---|
| 380 | if (getConfigParam('position') == 'over' || _player.fullscreen == true) { |
|---|
| 381 | x = getConfigParam('margin'); |
|---|
| 382 | y = height - background.height - getConfigParam('margin'); |
|---|
| 383 | wid = width - 2 * getConfigParam('margin'); |
|---|
| 384 | } |
|---|
| 385 | background.width = wid; |
|---|
| 386 | shade.width = wid; |
|---|
| 387 | updateControlbarState(); |
|---|
| 388 | redraw(); |
|---|
| 389 | Mouse.show(); |
|---|
| 390 | } |
|---|
| 391 | |
|---|
| 392 | |
|---|
| 393 | private function redraw():void { |
|---|
| 394 | clearDividers(); |
|---|
| 395 | _layoutManager.resize(_width, _height); |
|---|
| 396 | } |
|---|
| 397 | |
|---|
| 398 | |
|---|
| 399 | private function clearDividers():void { |
|---|
| 400 | for (var i:Number = 0; i < _dividers.length; i++){ |
|---|
| 401 | _dividers[i].visible = false; |
|---|
| 402 | _dividers[i] = null; |
|---|
| 403 | } |
|---|
| 404 | _dividers = []; |
|---|
| 405 | } |
|---|
| 406 | |
|---|
| 407 | public function get layout():String { |
|---|
| 408 | return _currentLayout; |
|---|
| 409 | } |
|---|
| 410 | |
|---|
| 411 | |
|---|
| 412 | private function getFont(textField:TextField):String { |
|---|
| 413 | var result:String; |
|---|
| 414 | if (textField) { |
|---|
| 415 | textField.getTextFormat().font; |
|---|
| 416 | } |
|---|
| 417 | return result; |
|---|
| 418 | } |
|---|
| 419 | |
|---|
| 420 | |
|---|
| 421 | private function get background():Sprite { |
|---|
| 422 | if (_buttons['background']) { |
|---|
| 423 | return _buttons['background']; |
|---|
| 424 | } |
|---|
| 425 | return (new Sprite()); |
|---|
| 426 | } |
|---|
| 427 | |
|---|
| 428 | |
|---|
| 429 | private function get shade():Sprite { |
|---|
| 430 | if (_buttons['shade']) { |
|---|
| 431 | return _buttons['shade']; |
|---|
| 432 | } |
|---|
| 433 | return (new Sprite()); |
|---|
| 434 | } |
|---|
| 435 | |
|---|
| 436 | |
|---|
| 437 | private function getConfigParam(param:String):* { |
|---|
| 438 | return player.config.pluginConfig("controlbar")[param]; |
|---|
| 439 | } |
|---|
| 440 | |
|---|
| 441 | |
|---|
| 442 | private function get config():PluginConfig { |
|---|
| 443 | return player.config.pluginConfig("controlbar"); |
|---|
| 444 | } |
|---|
| 445 | } |
|---|
| 446 | } |
|---|