Changeset 110
- Timestamp:
- 11/13/08 17:36:17 (5 years ago)
- Location:
- trunk/as3
- Files:
-
- 9 edited
-
com/jeroenwijering/events/ControllerEvent.as (modified) (1 diff)
-
com/jeroenwijering/events/ViewEvent.as (modified) (1 diff)
-
com/jeroenwijering/player/Controller.as (modified) (2 diffs)
-
com/jeroenwijering/player/Player.as (modified) (1 diff)
-
com/jeroenwijering/player/View.as (modified) (1 diff)
-
com/jeroenwijering/plugins/Controlbar.as (modified) (4 diffs)
-
com/jeroenwijering/utils/Stacker.as (modified) (2 diffs)
-
player.fla (modified) (previous)
-
player.swf (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
trunk/as3/com/jeroenwijering/events/ControllerEvent.as
r88 r110 24 24 public static var STOP:String = "STOP"; 25 25 public static var VOLUME:String = "VOLUME"; 26 public static var BUTTON:String = "BUTTON"; 26 27 /** The data associated with the event. **/ 27 28 private var _data:Object; -
trunk/as3/com/jeroenwijering/events/ViewEvent.as
r88 r110 28 28 public static var TRACE:String = "TRACE"; 29 29 public static var VOLUME:String = "VOLUME"; 30 public static var BUTTON:String = "BUTTON"; 30 31 /** The data associated with the event. **/ 31 32 private var _data:Object; -
trunk/as3/com/jeroenwijering/player/Controller.as
r109 r110 68 68 view.addEventListener(ViewEvent.STOP,stopHandler); 69 69 view.addEventListener(ViewEvent.VOLUME,volumeHandler); 70 view.addEventListener(ViewEvent.BUTTON,buttonHandler); 70 71 }; 71 72 … … 491 492 }; 492 493 494 /** Add new button to the control bar. **/ 495 private function buttonHandler(evt:ViewEvent):void { 496 var dat:Object = {icon:null,clickhandler:null,buttonname:""}; 497 try { 498 dat['icon'] = evt.data['icon']; 499 dat['clickhandler'] = evt.data['clickhandler']; 500 dat['buttonname'] = String(evt.data['buttonname']); 501 } catch(e:Error) {} 502 dispatchEvent(new ControllerEvent(ControllerEvent.BUTTON,dat)); 503 }; 504 493 505 494 506 } -
trunk/as3/com/jeroenwijering/player/Player.as
r109 r110 70 70 token:undefined, 71 71 tracecall:undefined, 72 version:'4.3.1 09'72 version:'4.3.110' 73 73 }; 74 74 /** Reference to all stage graphics. **/ -
trunk/as3/com/jeroenwijering/player/View.as
r109 r110 201 201 case 'VOLUME': 202 202 dat['percentage'] = prm; 203 break; 204 case 'BUTTON': 205 dat = prm; 203 206 break; 204 207 default: -
trunk/as3/com/jeroenwijering/plugins/Controlbar.as
r105 r110 7 7 import com.jeroenwijering.events.*; 8 8 import com.jeroenwijering.utils.*; 9 import flash.display.MovieClip; 9 10 import flash.display.*; 10 11 import flash.events.MouseEvent; 11 12 import flash.geom.ColorTransform; 12 13 import flash.geom.Rectangle; 14 import flash.net.URLRequest; 15 import flash.ui.Mouse; 16 import flash.utils.clearTimeout; 13 17 import flash.utils.setTimeout; 14 import flash.utils.clearTimeout;15 import flash.ui.Mouse;16 18 17 19 … … 54 56 } 55 57 58 /** Button next to which custom buttons are added **/ 59 private var insertNextTo:MovieClip = null; 60 56 61 57 62 /** Constructor. **/ … … 70 75 view.addControllerListener(ControllerEvent.MUTE,muteHandler); 71 76 view.addControllerListener(ControllerEvent.VOLUME,volumeHandler); 77 view.addControllerListener(ControllerEvent.BUTTON,buttonHandler); 72 78 bar = view.skin['controlbar']; 79 80 if(bar.hasOwnProperty('blankButton')) { 81 bar.blankButton.visible = false; 82 } 83 73 84 margin = bar.x; 74 85 stacker = new Stacker(bar); … … 421 432 }; 422 433 423 434 /** Add a new button to the controlbar **/ 435 private function buttonHandler(evt:ControllerEvent=null):void { 436 if(!insertNextTo) { insertNextTo = bar['linkButton']; } 437 if(bar.hasOwnProperty('blankButton')) { 438 try { 439 var newButton:MovieClip = Draw.clone(bar['blankButton']); 440 newButton.name = evt.data.buttonname; 441 newButton.visible = true; 442 443 var newIcon = null; 444 445 if(evt.data.icon is String) { 446 newIcon = new Loader(); 447 newIcon.load(new URLRequest(evt.data.icon)); 448 } else if(evt.data.icon is Sprite) { 449 newIcon = evt.data.icon as Sprite; 450 } 451 452 if(newIcon) { 453 newIcon.x = newButton['icon'].x; 454 newIcon.y = newButton['icon'].y; 455 newIcon.name = 'icon'; 456 newButton.removeChild(newButton['icon']); 457 newButton.addChild(newIcon); 458 } 459 460 newButton.addEventListener(MouseEvent.CLICK, evt.data.clickhandler); 461 462 bar.addChild(newButton); 463 464 stacker.insert(newButton, insertNextTo); 465 insertNextTo = newButton; 466 467 } catch (err:Error) {} 468 } 469 }; 424 470 }; 425 471 -
trunk/as3/com/jeroenwijering/utils/Stacker.as
r88 r110 1 /**1 /** 2 2 * Parses children of a MovieClip and docks them to the left & right. 3 3 **/ … … 117 117 }; 118 118 119 public function insert(insrt:MovieClip,next:MovieClip):void { 120 var found:Number = -1; 121 for(var i:Number=0; i<stack.length && found < 0; i++) { 122 if(stack[i].c == next) { 123 stack.splice(i, 0, {c:insrt,x:stack[i].x-insrt.width,n:insrt.name,w:insrt.width}); 124 found = i; 125 break; 126 } 127 } 128 rearrange(); 129 130 } 119 131 120 132 }
Note: See TracChangeset
for help on using the changeset viewer.
