Changeset 57
- Timestamp:
- 08/12/08 05:04:55 (5 years ago)
- Files:
-
- 7 added
- 1 deleted
- 46 edited
-
tags/imagerotator-3-17.zip (added)
-
trunk/as2/com/jeroenwijering/players/AbstractView.as (modified) (1 diff)
-
trunk/as2/com/jeroenwijering/players/FLVModel.as (modified) (2 diffs)
-
trunk/as2/com/jeroenwijering/players/ImageRotator.as (modified) (3 diffs)
-
trunk/as2/com/jeroenwijering/players/JavascriptView.as (modified) (1 diff)
-
trunk/as2/com/jeroenwijering/players/MediaPlayer.as (modified) (2 diffs)
-
trunk/as2/com/jeroenwijering/players/PlayerController.as (modified) (1 diff)
-
trunk/as2/com/jeroenwijering/players/RotatorController.as (modified) (3 diffs)
-
trunk/as2/com/jeroenwijering/players/RotatorView.as (modified) (13 diffs)
-
trunk/as2/com/jeroenwijering/utils/ImageLoader.as (modified) (3 diffs)
-
trunk/as2/imagerotator.fla (modified) (previous)
-
trunk/as2/imagerotator.html (added)
-
trunk/as2/imagerotator.pdf (modified) (previous)
-
trunk/as2/imagerotator.swf (modified) (previous)
-
trunk/as2/madrid.xml (added)
-
trunk/as2/madrid1.jpg (added)
-
trunk/as2/madrid2.jpg (added)
-
trunk/as2/madrid3.jpg (added)
-
trunk/as2/mediaplayer.html (added)
-
trunk/as2/mediaplayer.swf (modified) (previous)
-
trunk/as2/readme.html (deleted)
-
trunk/as3/com/jeroenwijering/events/AbstractView.as (modified) (1 diff)
-
trunk/as3/com/jeroenwijering/events/ControllerEvent.as (modified) (1 diff)
-
trunk/as3/com/jeroenwijering/events/ModelEvent.as (modified) (1 diff)
-
trunk/as3/com/jeroenwijering/events/PluginInterface.as (modified) (1 diff)
-
trunk/as3/com/jeroenwijering/events/ViewEvent.as (modified) (1 diff)
-
trunk/as3/com/jeroenwijering/models/CameraModel.as (modified) (11 diffs)
-
trunk/as3/com/jeroenwijering/models/HTTPModel.as (modified) (14 diffs)
-
trunk/as3/com/jeroenwijering/models/ImageModel.as (modified) (12 diffs)
-
trunk/as3/com/jeroenwijering/models/ModelInterface.as (modified) (1 diff)
-
trunk/as3/com/jeroenwijering/models/RTMPModel.as (modified) (15 diffs)
-
trunk/as3/com/jeroenwijering/models/SoundModel.as (modified) (11 diffs)
-
trunk/as3/com/jeroenwijering/models/VideoModel.as (modified) (14 diffs)
-
trunk/as3/com/jeroenwijering/models/YoutubeModel.as (modified) (14 diffs)
-
trunk/as3/com/jeroenwijering/parsers/SMILParser.as (modified) (1 diff)
-
trunk/as3/com/jeroenwijering/player/Controller.as (modified) (21 diffs)
-
trunk/as3/com/jeroenwijering/player/Model.as (modified) (15 diffs)
-
trunk/as3/com/jeroenwijering/player/Player.as (modified) (6 diffs)
-
trunk/as3/com/jeroenwijering/player/SWFLoader.as (modified) (8 diffs)
-
trunk/as3/com/jeroenwijering/player/View.as (modified) (14 diffs)
-
trunk/as3/com/jeroenwijering/plugins/Captions.as (modified) (8 diffs)
-
trunk/as3/com/jeroenwijering/plugins/Controlbar.as (modified) (18 diffs)
-
trunk/as3/com/jeroenwijering/plugins/Display.as (modified) (9 diffs)
-
trunk/as3/com/jeroenwijering/plugins/Playlist.as (modified) (20 diffs)
-
trunk/as3/com/jeroenwijering/utils/Animations.as (modified) (6 diffs)
-
trunk/as3/com/jeroenwijering/utils/Configger.as (modified) (6 diffs)
-
trunk/as3/com/jeroenwijering/utils/Draw.as (modified) (1 diff)
-
trunk/as3/com/jeroenwijering/utils/NetClient.as (modified) (13 diffs)
-
trunk/as3/com/jeroenwijering/utils/Playlister.as (modified) (6 diffs)
-
trunk/as3/com/jeroenwijering/utils/Randomizer.as (modified) (1 diff)
-
trunk/as3/com/jeroenwijering/utils/Stacker.as (modified) (8 diffs)
-
trunk/as3/com/jeroenwijering/utils/Stretcher.as (modified) (1 diff)
-
trunk/as3/com/jeroenwijering/utils/TEA.as (modified) (1 diff)
-
trunk/as3/player.swf (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
trunk/as2/com/jeroenwijering/players/AbstractView.as
r1 r57 85 85 /** Send event to the controller. **/ 86 86 private function sendEvent(typ:String,prm:Number) { 87 controller.getEvent(typ,prm); 87 controller.getEvent(typ,prm); 88 88 }; 89 89 -
trunk/as2/com/jeroenwijering/players/FLVModel.as
r1 r57 94 94 if(pos < 1) { 95 95 pos = 0; 96 } else if (pos > feeder.feed[currentItem]["duration"] - 1) {97 pos = feeder.feed[currentItem]["duration"] -1;96 } else if (pos > feeder.feed[currentItem]["duration"]-1) { 97 pos = feeder.feed[currentItem]["duration"]-1; 98 98 } 99 99 if (flvType=="RTMP" && feeder.feed[currentItem]["id"] != currentURL) { … … 201 201 /** Pause the video that's currently playing. **/ 202 202 private function setPause(pos:Number) { 203 if(pos < 1) { pos = 0; } 203 if(pos < 1) { 204 pos = 0; 205 } else if (pos > feeder.feed[currentItem]["duration"]-1) { 206 pos = feeder.feed[currentItem]["duration"]-1; 207 } 204 208 clearInterval(positionInterval); 205 209 if(pos != undefined) { -
trunk/as2/com/jeroenwijering/players/ImageRotator.as
r1 r57 10 10 11 11 12 class com.jeroenwijering.players.ImageRotator extends AbstractPlayer { 12 class com.jeroenwijering.players.ImageRotator extends AbstractPlayer { 13 13 14 14 … … 43 43 rotatetime:5, 44 44 shuffle:"true", 45 usefullscreen:'true', 45 46 volume:80, 46 47 … … 51 52 useaudio:"true", 52 53 53 abouttxt:"JW Image Rotator 3.1 6",54 abouttxt:"JW Image Rotator 3.17", 54 55 aboutlnk:"http://www.jeroenwijering.com/?about=JW_Image_Rotator" 55 56 }; -
trunk/as2/com/jeroenwijering/players/JavascriptView.as
r1 r57 36 36 super(ctr,cfg,fed); 37 37 if(ExternalInterface.available) { 38 ExternalInterface.addCallback("sendEvent",this,sendEvent); 38 try { 39 ExternalInterface.addCallback("sendEvent",this,sendEvent); 40 } catch(err) {} 39 41 } 40 42 }; -
trunk/as2/com/jeroenwijering/players/MediaPlayer.as
r1 r57 22 22 displayheight:undefined, 23 23 displaywidth:undefined, 24 searchbar:' true',24 searchbar:'false', 25 25 26 26 file:undefined, … … 78 78 usekeys:'true', 79 79 80 abouttxt:'JW Player 3.1 6',80 abouttxt:'JW Player 3.17', 81 81 aboutlnk:'http://www.jeroenwijering.com/?about=JW_FLV_Media_Player' 82 82 }; -
trunk/as2/com/jeroenwijering/players/PlayerController.as
r1 r57 53 53 } 54 54 if(config["autostart"] == "false") { 55 isPlaying = false; 55 56 sendChange("pause",feeder.feed[currentItem]['start']); 56 isPlaying = false;57 57 } else { 58 58 sendChange("start",feeder.feed[currentItem]['start']); -
trunk/as2/com/jeroenwijering/players/RotatorController.as
r1 r57 105 105 /** Play a new item. **/ 106 106 private function setPlayitem(itm:Number) { 107 if(itm != currentItem) { 108 sendChange("stop"); 109 itm > feeder.feed.length-1 ? itm = feeder.feed.length-1: null; 110 currentItem = itm; 111 sendChange("item",itm); 112 } 107 sendChange("stop"); 108 itm > feeder.feed.length-1 ? itm = feeder.feed.length-1: null; 109 currentItem = itm; 110 sendChange("item",itm); 113 111 if(feeder.feed[itm]["start"] == undefined) { 114 112 sendChange("start",0); … … 132 130 133 131 /** Determine what to do if an item is completed. **/ 134 private function setComplete() { 132 private function setComplete() { 135 133 itemsPlayed++; 136 134 if(config["repeat"]=="false" || (config["repeat"] == "list" 137 && itemsPlayed >= feeder.feed.length)) {135 && currentItem == feeder.feed.length-1)) { 138 136 sendChange("pause",0); 139 137 isPlaying = false; … … 169 167 170 168 169 /** Fullscreen switch function. **/ 170 private function setFullscreen() { 171 if(Stage["displayState"] == "normal" && config["usefullscreen"] == "true") { 172 Stage["displayState"] = "fullScreen"; 173 } else if (Stage["displayState"] == "fullScreen" && 174 config["usefullscreen"] == "true") { 175 Stage["displayState"] = "normal"; 176 } 177 }; 178 179 171 180 /** Switch active model and send changes. **/ 172 181 private function sendChange(typ:String,prm:Number):Void { -
trunk/as2/com/jeroenwijering/players/RotatorView.as
r1 r57 42 42 "slowfade" 43 43 ); 44 /** Dimensions of the display **/ 45 private var dims:Array; 44 46 45 47 … … 47 49 function RotatorView(ctr:AbstractController,cfg:Object,fed:Object) { 48 50 super(ctr,cfg,fed); 51 dims = new Array(config['width'],config['height']); 49 52 setColorsClicks(); 50 53 if(config["shownavigation"] == "true") { 51 54 Mouse.addListener(this); 55 Stage.addListener(this); 52 56 } 53 57 }; … … 58 62 var ref = this; 59 63 var tgt:MovieClip = config["clip"]; 60 tgt.button._width = config["width"];61 tgt.button._height = config["height"];64 tgt.button._width = dims[0]; 65 tgt.button._height = dims[1]; 62 66 if(config['overstretch']=='true' || config['overstretch']=='fit') { 63 67 tgt.img1.bg._visible = tgt.img2.bg._visible = false; 64 68 } else { 65 tgt.img1.bg._width = tgt.img2.bg._width = config["width"];66 tgt.img1.bg._height = tgt.img2.bg._height = config["height"];69 tgt.img1.bg._width = tgt.img2.bg._width = dims[0]; 70 tgt.img1.bg._height = tgt.img2.bg._height = dims[1]; 67 71 tgt.img1.col = new Color(tgt.img1.bg); 68 72 tgt.img1.col.setRGB(config["screencolor"]); … … 86 90 tgt.navigation.swapDepths(6); 87 91 tgt.logo.swapDepths(7); 88 tgt.playicon._x=tgt.activity._x = Math.round( config["width"]/2);89 tgt.playicon._y=tgt.activity._y = Math.round( config["height"]/2);92 tgt.playicon._x=tgt.activity._x = Math.round(dims[0]/2); 93 tgt.playicon._y=tgt.activity._y = Math.round(dims[1]/2); 90 94 if(config["logo"] != undefined) { 91 95 var lll = new ImageLoader(tgt.logo,"none"); 92 96 lll.onLoadFinished = function() { 93 ref.config['clip'].logo._x = ref. config["displaywidth"] -97 ref.config['clip'].logo._x = ref.dims[0] - 94 98 ref.config['clip'].logo._width -10; 95 99 ref.config['clip'].logo._y = 10; … … 99 103 tgt = config["clip"].navigation; 100 104 if (config["shownavigation"] == "true") { 101 tgt._y = config["height"] - 40;102 tgt._x = config["width"]/2 - 50;105 tgt._y = dims[1] - 40; 106 tgt._x = dims[0]/2 - 50; 103 107 tgt.prevBtn.col1 = new Color(tgt.prevBtn.bck); 104 108 tgt.prevBtn.col1.setRGB(config["backcolor"]); … … 199 203 tgt.audioBtn._x = 0; 200 204 tgt.audioBtn._visible = false; 201 } 202 tgt._x = Math.round(config["width"]/2 - tgt._width/2); 205 } 206 207 if(Stage["displayState"] == "normal" && config["usefullscreen"] == "true") { 208 tgt.fullscreenBtn.col1 = new Color(tgt.fullscreenBtn.bck); 209 tgt.fullscreenBtn.col2 = new Color(tgt.fullscreenBtn.icnOn); 210 tgt.fullscreenBtn.col3 = new Color(tgt.fullscreenBtn.icnOff); 211 tgt.fullscreenBtn.col1.setRGB(config["backcolor"]); 212 tgt.fullscreenBtn.col2.setRGB(config["frontcolor"]); 213 tgt.fullscreenBtn.col3.setRGB(config["frontcolor"]); 214 tgt.fullscreenBtn.onRollOver = function() { 215 this.col2.setRGB(ref.config["lightcolor"]); 216 this.col3.setRGB(ref.config["lightcolor"]); 217 }; 218 tgt.fullscreenBtn.onRollOut = function() { 219 this.col2.setRGB(ref.config["frontcolor"]); 220 this.col3.setRGB(ref.config["frontcolor"]); 221 }; 222 tgt.fullscreenBtn.onRelease = function() { 223 ref.sendEvent("fullscreen"); 224 this.col2.setRGB(ref.config["frontcolor"]); 225 this.col3.setRGB(ref.config["frontcolor"]); 226 }; 227 tgt.fullscreenBtn.icnOff._visible = false; 228 if(feeder.audio == true) { 229 tgt.fullscreenBtn._x = len*6 + 130; 230 } else { 231 tgt.fullscreenBtn._x = len*6 + 104; 232 } 233 } else { 234 tgt.fullscreenBtn._x = 0; 235 tgt.fullscreenBtn._visible = false; 236 } 237 tgt._x = Math.round(dims[0]/2 - tgt._width/2); 203 238 } else { 204 239 tgt._visible = false; … … 268 303 clp._y = 0; 269 304 } else if (dir == 2) { 270 clp._x = config['width'] - upClip._width;271 } else { 272 clp._y = config['height'] - upClip._height;305 clp._x = dims[0] - upClip._width; 306 } else { 307 clp._y = dims[1] - upClip._height; 273 308 } 274 309 clp.onEnterFrame = function() { … … 372 407 config["clip"].attachMovie("blocksMask","mask",3); 373 408 var msk:MovieClip = config["clip"].mask; 374 if ( config["width"] > config["height"]) {375 msk._width = msk._height = config["width"];376 } else { 377 msk._width = msk._height = config["height"];409 if (dims[0] > dims[1]) { 410 msk._width = msk._height = dims[0]; 411 } else { 412 msk._width = msk._height = dims[1]; 378 413 } 379 414 msk._rotation = random(4)*90; 380 msk._rotation == 90 ? msk._x = config["width"]: null;381 msk._rotation == 180 ? msk._x = config["width"]: null;382 msk._rotation == 180 ? msk._y = config["height"]: null;383 msk._rotation == -90 ? msk._y = config["height"]: null;415 msk._rotation == 90 ? msk._x = dims[0]: null; 416 msk._rotation == 180 ? msk._x = dims[0]: null; 417 msk._rotation == 180 ? msk._y = dims[1]: null; 418 msk._rotation == -90 ? msk._y = dims[1]: null; 384 419 upClip.setMask(msk); 385 420 playClip(msk); … … 393 428 var msk:MovieClip = config["clip"].mask; 394 429 upClip.setMask(msk); 395 if ( config["width"] > config["height"]) {396 msk._width = msk._height = config["width"];397 msk._y = config["height"]/2 - msk._height/2;398 } else { 399 msk._width = msk._height = config["height"];400 msk._x = config["width"]/2- msk._width/2;430 if (dims[0] > dims[1]) { 431 msk._width = msk._height = dims[0]; 432 msk._y = dims[1]/2 - msk._height/2; 433 } else { 434 msk._width = msk._height = dims[1]; 435 msk._x = dims[0]/2- msk._width/2; 401 436 } 402 437 if(random(2) == 1) { 403 438 msk._xscale = -msk._xscale; 404 msk._x += config['width'];439 msk._x += dims[0]; 405 440 } 406 441 playClip(msk); … … 414 449 var msk:MovieClip = config["clip"].mask; 415 450 upClip.setMask(msk); 416 if ( config["width"] > config["height"]) {417 msk._width = msk._height = config["width"];418 } else { 419 msk._width = msk._height = config["height"];420 } 421 msk._x = config["width"]/2;422 msk._y = config["height"]/2;451 if (dims[0] > dims[1]) { 452 msk._width = msk._height = dims[0]; 453 } else { 454 msk._width = msk._height = dims[1]; 455 } 456 msk._x = dims[0]/2; 457 msk._y = dims[1]/2; 423 458 playClip(msk,10); 424 459 }; … … 451 486 var msk:MovieClip = config["clip"].mask; 452 487 upClip.setMask(msk); 453 msk._width = config["width"];454 msk._height = config["height"];488 msk._width = dims[0]; 489 msk._height = dims[1]; 455 490 playClip(msk); 456 491 }; … … 463 498 var msk:MovieClip = config["clip"].mask; 464 499 upClip.setMask(msk); 465 msk._width = config["width"];466 msk._height = config["height"];500 msk._width = dims[0]; 501 msk._height = dims[1]; 467 502 playClip(msk); 468 503 }; … … 516 551 517 552 553 /** Catches fullscreen escape **/ 554 public function onFullScreen(fs:Boolean) { 555 if(fs == false) { 556 dims = new Array(config['width'],config['height']); 557 } else { 558 dims = new Array(Stage.width,Stage.height); 559 } 560 config["clip"].navigation.fullscreenBtn.icnOn._visible = !fs; 561 config["clip"].navigation.fullscreenBtn.icnOff._visible = fs; 562 setDimensions(); 563 sendEvent('playitem',currentItem); 564 }; 565 566 /** Resize after a fullscreen enter/leave **/ 567 private function setDimensions() { 568 var tgt:MovieClip = config["clip"]; 569 tgt.button._width = tgt.img1.bg._width = tgt.img2.bg._width = dims[0]; 570 tgt.button._height = tgt.img1.bg._height = tgt.img2.bg._height = dims[1]; 571 tgt.playicon._x = tgt.activity._x = Math.round(dims[0]/2); 572 tgt.playicon._y = tgt.activity._y = Math.round(dims[1]/2); 573 tgt.logo._x = dims[0] - tgt.logo._width -10; 574 if (config["shownavigation"] == "true") { 575 tgt.navigation._y = dims[1] - 40; 576 tgt.navigation._x = Math.round(dims[0]/2-tgt.navigation._width/2); 577 } 578 }; 579 580 518 581 } -
trunk/as2/com/jeroenwijering/utils/ImageLoader.as
r1 r57 77 77 /** Scale the image while maintaining aspectratio **/ 78 78 private function scaleImage(tgt:MovieClip):Void { 79 if(Stage["displayState"] == "fullScreen") { 80 var tgw = Stage.width; 81 var tgh = Stage.height; 82 } else { 83 var tgw = targetWidth; 84 var tgh = targetHeight; 85 } 79 86 targetClip._xscale = targetClip._yscale = 100; 80 87 var tcf = tgt._currentframe; … … 83 90 sourceHeight = tgt._height; 84 91 sourceLength = tgt._totalframes/20; 85 var xsr = t argetWidth/sourceWidth;86 var ysr = t argetHeight/sourceHeight;92 var xsr = tgw/sourceWidth; 93 var ysr = tgh/sourceHeight; 87 94 if (overStretch == "fit" || Math.abs(xsr-ysr) < 0.1) { 88 tgt._width = t argetWidth;89 tgt._height = t argetHeight;95 tgt._width = tgw; 96 tgt._height = tgh; 90 97 } else if ((overStretch == "true" && xsr > ysr) || 91 98 (overStretch == "false" && xsr < ysr)) { … … 97 104 } 98 105 if(targetWidth != undefined) { 99 tgt._x = t argetWidth/2 - tgt._width/2;100 tgt._y = t argetHeight/2 - tgt._height/2;106 tgt._x = tgw/2 - tgt._width/2; 107 tgt._y = tgh/2 - tgt._height/2; 101 108 } 102 109 tgt.gotoAndPlay(tcf); -
trunk/as3/com/jeroenwijering/events/AbstractView.as
r13 r57 23 23 24 24 /** Subscribers to the controller and model. **/ 25 public function addControllerListener(typ:String,fcn:Function) {};26 public function addModelListener(typ:String,fcn:Function) {};27 public function addViewListener(typ:String,fcn:Function) {};25 public function addControllerListener(typ:String,fcn:Function):void {}; 26 public function addModelListener(typ:String,fcn:Function):void {}; 27 public function addViewListener(typ:String,fcn:Function):void {}; 28 28 29 29 30 30 /** Dispatch events. **/ 31 public function sendEvent(typ:String,prm:Object=undefined) { };31 public function sendEvent(typ:String,prm:Object=undefined):void { }; 32 32 33 33 -
trunk/as3/com/jeroenwijering/events/ControllerEvent.as
r49 r57 32 32 * @param dat An object with all associated data. 33 33 **/ 34 public function ControllerEvent(typ:String,dat:Object=undefined,bbl:Boolean=false,ccb:Boolean=false) {34 public function ControllerEvent(typ:String,dat:Object=undefined,bbl:Boolean=false,ccb:Boolean=false):void { 35 35 super(typ,bbl,ccb); 36 36 _data = dat; -
trunk/as3/com/jeroenwijering/events/ModelEvent.as
r1 r57 28 28 * @param dat An object with all associated data. 29 29 **/ 30 public function ModelEvent(typ:String,dat:Object=undefined,bbl:Boolean=false,ccb:Boolean=false) {30 public function ModelEvent(typ:String,dat:Object=undefined,bbl:Boolean=false,ccb:Boolean=false):void { 31 31 super(typ,bbl,ccb); 32 32 _data = dat; -
trunk/as3/com/jeroenwijering/events/PluginInterface.as
r56 r57 11 11 12 12 13 function initializePlugin(vie:AbstractView) ;13 function initializePlugin(vie:AbstractView):void; 14 14 15 15 -
trunk/as3/com/jeroenwijering/events/ViewEvent.as
r53 r57 36 36 * @param dat An object with all associated data. 37 37 **/ 38 public function ViewEvent(typ:String,dat:Object=undefined,bbl:Boolean=false,ccb:Boolean=false) {38 public function ViewEvent(typ:String,dat:Object=undefined,bbl:Boolean=false,ccb:Boolean=false):void { 39 39 super(typ, bbl, ccb); 40 40 _data = dat; -
trunk/as3/com/jeroenwijering/models/CameraModel.as
r49 r57 36 36 37 37 38 public function CameraModel(mod:Model) {38 public function CameraModel(mod:Model):void { 39 39 model = mod; 40 40 try { … … 54 54 55 55 /** Catch security errors. **/ 56 private function errorHandler(evt:ErrorEvent) {56 private function errorHandler(evt:ErrorEvent):void { 57 57 model.sendEvent(ModelEvent.ERROR,{message:evt.text}); 58 58 }; … … 61 61 62 62 /** Load the camera into the video **/ 63 public function load() {63 public function load():void { 64 64 position = model.playlist[model.config['item']]['start']; 65 65 model.mediaHandler(video); … … 73 73 74 74 /** Pause playback. **/ 75 public function pause() {75 public function pause():void { 76 76 video.attachCamera(null); 77 77 if(stream) { … … 86 86 87 87 /** Resume playback **/ 88 public function play() {88 public function play():void { 89 89 video.attachCamera(camera); 90 90 model.sendEvent(ModelEvent.STATE,{newstate:ModelStates.PLAYING}); … … 99 99 100 100 /** Change the quality mode. **/ 101 public function quality(stt:Boolean) {101 public function quality(stt:Boolean):void { 102 102 if(stt == true) { 103 103 camera.setMode(480,360,25); … … 115 115 116 116 /** Seek the camera timeline. **/ 117 public function seek(pos:Number) {117 public function seek(pos:Number):void { 118 118 position = pos; 119 119 clearInterval(interval); … … 123 123 124 124 /** Destroy the videocamera. **/ 125 public function stop() {125 public function stop():void { 126 126 position = 0; 127 127 video.attachCamera(null); … … 132 132 133 133 /** Receive NetStream status updates. **/ 134 private function statusHandler(evt:NetStatusEvent) {134 private function statusHandler(evt:NetStatusEvent):void { 135 135 if(evt.info.code == "NetConnection.Connect.Success") { 136 136 stream = new NetStream(connection); … … 143 143 144 144 /** Interval function that countdowns the time. **/ 145 private function timeInterval() {145 private function timeInterval():void { 146 146 position = Math.round(position*10+1)/10; 147 147 var dur = model.playlist[model.config['item']]['duration']; … … 158 158 159 159 /** Volume setting **/ 160 public function volume(pct:Number) {};160 public function volume(pct:Number):void {}; 161 161 162 162 -
trunk/as3/com/jeroenwijering/models/HTTPModel.as
r55 r57 48 48 49 49 /** Constructor; sets up the connection and display. **/ 50 public function HTTPModel(mod:Model) {50 public function HTTPModel(mod:Model):void { 51 51 model = mod; 52 52 connection = new NetConnection(); … … 72 72 73 73 /** Catch security errors. **/ 74 private function errorHandler(evt:ErrorEvent) {74 private function errorHandler(evt:ErrorEvent):void { 75 75 model.sendEvent(ModelEvent.ERROR,{message:evt.text}); 76 76 }; … … 99 99 100 100 /** Load content. **/ 101 public function load() {101 public function load():void { 102 102 if(stream.bytesLoaded != stream.bytesTotal) { 103 103 stream.close(); … … 132 132 133 133 /** Interval for the loading progress **/ 134 private function loadHandler() {134 private function loadHandler():void { 135 135 loaded = stream.bytesLoaded; 136 136 var ttl = stream.bytesTotal; … … 143 143 144 144 /** Catch noncritical errors. **/ 145 private function metaHandler(evt:ErrorEvent) {145 private function metaHandler(evt:ErrorEvent):void { 146 146 model.sendEvent(ModelEvent.META,{error:evt.text}); 147 147 }; … … 149 149 150 150 /** Get metadata information from netstream class. **/ 151 public function onData(dat:Object) {151 public function onData(dat:Object):void { 152 152 if(dat.type == 'metadata' && !h264) { 153 153 if(dat.width) { … … 181 181 182 182 /** Pause playback. **/ 183 public function pause() {183 public function pause():void { 184 184 clearInterval(timeinterval); 185 185 stream.pause(); … … 189 189 190 190 /** Resume playing. **/ 191 public function play() {191 public function play():void { 192 192 stream.resume(); 193 193 timeinterval = setInterval(timeHandler,100); … … 197 197 198 198 /** Change the smoothing mode. **/ 199 public function seek(pos:Number) {199 public function seek(pos:Number):void { 200 200 clearInterval(timeinterval); 201 201 var off = getOffset(pos); … … 216 216 217 217 /** Change the smoothing mode. **/ 218 public function quality(qua:Boolean) {218 public function quality(qua:Boolean):void { 219 219 if(qua == true) { 220 220 video.smoothing = true; … … 228 228 229 229 /** Receive NetStream status updates. **/ 230 private function statusHandler(evt:NetStatusEvent) {230 private function statusHandler(evt:NetStatusEvent):void { 231 231 if(evt.info.code == "NetStream.Play.Stop") { 232 232 if(model.config['state'] != ModelStates.COMPLETED) { … … 245 245 246 246 /** Destroy the HTTP stream. **/ 247 public function stop() {247 public function stop():void { 248 248 clearInterval(loadinterval); 249 249 clearInterval(timeinterval); … … 259 259 260 260 /** Interval for the position progress **/ 261 private function timeHandler() {261 private function timeHandler():void { 262 262 var bfr = Math.round(stream.bufferLength/stream.bufferTime*100); 263 263 var pos = Math.round(stream.time*10)/10; … … 284 284 285 285 /** Set the volume level. **/ 286 public function volume(vol:Number) {286 public function volume(vol:Number):void { 287 287 transform.volume = vol/100; 288 288 stream.soundTransform = transform; -
trunk/as3/com/jeroenwijering/models/ImageModel.as
r53 r57 31 31 32 32 /** Constructor; sets up listeners **/ 33 public function ImageModel(mod:Model) {33 public function ImageModel(mod:Model):void { 34 34 model = mod; 35 35 loader = new Loader(); … … 41 41 42 42 /** load image into screen **/ 43 public function load() {43 public function load():void { 44 44 clearInterval(interval); 45 45 position = model.playlist[model.config['item']]['start']; … … 51 51 52 52 /** Catch errors. **/ 53 private function errorHandler(evt:ErrorEvent) {53 private function errorHandler(evt:ErrorEvent):void { 54 54 model.sendEvent(ModelEvent.ERROR,{message:evt.text}); 55 55 }; … … 57 57 58 58 /** Load and place the image on stage. **/ 59 private function loaderHandler(evt:Event) {59 private function loaderHandler(evt:Event):void { 60 60 model.mediaHandler(loader); 61 61 quality(model.config['quality']); … … 67 67 68 68 /** Resume playback of the images **/ 69 public function play() {69 public function play():void { 70 70 interval = setInterval(timeInterval,100); 71 71 model.sendEvent(ModelEvent.STATE,{newstate:ModelStates.PLAYING}); … … 74 74 75 75 /** Show or hide the camera. **/ 76 public function pause() {76 public function pause():void { 77 77 clearInterval(interval); 78 78 model.sendEvent(ModelEvent.STATE,{newstate:ModelStates.PAUSED}); … … 81 81 82 82 /** Send load progress to player. **/ 83 private function progressHandler(evt:ProgressEvent) {83 private function progressHandler(evt:ProgressEvent):void { 84 84 var pct = Math.round(evt.bytesLoaded/evt.bytesTotal*100); 85 85 model.sendEvent(ModelEvent.BUFFER,{percentage:pct}); … … 88 88 89 89 /** Change the quality mode. **/ 90 public function quality(stt:Boolean) {90 public function quality(stt:Boolean):void { 91 91 try { 92 92 Bitmap(loader.content).smoothing = stt; … … 96 96 97 97 /** Scrub the image to a certain position. **/ 98 public function seek(pos:Number) {98 public function seek(pos:Number):void { 99 99 clearInterval(interval); 100 100 position = pos; … … 104 104 105 105 /** Stop the image interval. **/ 106 public function stop() {106 public function stop():void { 107 107 flash.media.SoundMixer.stopAll(); 108 108 clearInterval(interval); … … 116 116 117 117 /** Interval function that countdowns the time. **/ 118 private function timeInterval() {118 private function timeInterval():void { 119 119 position = Math.round(position*10+1)/10; 120 120 var dur = model.playlist[model.config['item']]['duration']; … … 130 130 131 131 /** Volume setting **/ 132 public function volume(pct:Number) { };132 public function volume(pct:Number):void { }; 133 133 134 134 -
trunk/as3/com/jeroenwijering/models/ModelInterface.as
r1 r57 11 11 12 12 /** Load a file into the model. **/ 13 function load() ;13 function load():void; 14 14 /** Playback resume directive. **/ 15 function play() ;15 function play():void; 16 16 /** Playback pause directive. **/ 17 function pause() ;17 function pause():void; 18 18 /** Playback seeking directive. **/ 19 function seek(pos:Number) ;19 function seek(pos:Number):void; 20 20 /** Stop the item altogether. **/ 21 function stop() ;21 function stop():void; 22 22 /** Set or toggle the playback quality. **/ 23 function quality(stt:Boolean) ;23 function quality(stt:Boolean):void; 24 24 /** Change the volume. **/ 25 function volume(vol:Number) ;25 function volume(vol:Number):void; 26 26 27 27 -
trunk/as3/com/jeroenwijering/models/RTMPModel.as
r53 r57 39 39 40 40 /** Constructor; sets up the connection and display. **/ 41 public function RTMPModel(mod:Model) {41 public function RTMPModel(mod:Model):void { 42 42 model = mod; 43 43 connection = new NetConnection(); … … 56 56 57 57 /** Catch security errors. **/ 58 private function errorHandler(evt:ErrorEvent) {58 private function errorHandler(evt:ErrorEvent):void { 59 59 model.sendEvent(ModelEvent.ERROR,{message:evt.text}); 60 60 }; … … 76 76 77 77 /** Load content. **/ 78 public function load() {78 public function load():void { 79 79 connection.connect(model.config['streamer']); 80 80 model.sendEvent(ModelEvent.STATE,{newstate:ModelStates.BUFFERING}); … … 83 83 84 84 /** Catch noncritical errors. **/ 85 private function metaHandler(evt:ErrorEvent) {85 private function metaHandler(evt:ErrorEvent):void { 86 86 model.sendEvent(ModelEvent.META,{error:evt.text}); 87 87 }; … … 89 89 90 90 /** Get metadata information from netstream class. **/ 91 public function onData(dat:Object) {91 public function onData(dat:Object):void { 92 92 if(dat.type == 'metadata' && !metadata) { 93 93 metadata = true; … … 114 114 115 115 /** Pause playback. **/ 116 public function pause() {116 public function pause():void { 117 117 clearInterval(timeinterval); 118 118 stream.pause(); … … 122 122 123 123 /** Resume playing. **/ 124 public function play() {124 public function play():void { 125 125 clearTimeout(timeout); 126 126 clearInterval(timeinterval); … … 132 132 133 133 /** Change the smoothing mode. **/ 134 public function quality(qua:Boolean) {134 public function quality(qua:Boolean):void { 135 135 if(qua == true) { 136 136 video.smoothing = true; … … 144 144 145 145 /** Change the smoothing mode. **/ 146 public function seek(pos:Number) {146 public function seek(pos:Number):void { 147 147 clearTimeout(timeout); 148 148 clearInterval(timeinterval); … … 157 157 158 158 /** Set streaming object **/ 159 public function setStream() {159 public function setStream():void { 160 160 var url = getID(model.playlist[model.config['item']]['file']); 161 161 stream = new NetStream(connection); … … 174 174 175 175 /** Receive NetStream status updates. **/ 176 private function statusHandler(evt:NetStatusEvent) {176 private function statusHandler(evt:NetStatusEvent):void { 177 177 if(evt.info.code == "NetConnection.Connect.Success") { 178 178 if (evt.info.secureToken != undefined) { … … 199 199 200 200 /** Destroy the stream. **/ 201 public function stop() {201 public function stop():void { 202 202 metadata = false; 203 203 clearInterval(timeinterval); … … 209 209 210 210 /** Akamai & Limelight subscribes. **/ 211 private function subscribe(nme:String) {211 private function subscribe(nme:String):void { 212 212 connection.call("FCSubscribe",null,nme); 213 213 }; … … 215 215 216 216 /** Interval for the position progress **/ 217 private function timeHandler() {217 private function timeHandler():void { 218 218 var bfr = Math.round(stream.bufferLength/stream.bufferTime*100); 219 219 var pos = Math.round(stream.time*10)/10; … … 239 239 240 240 /** Set the volume level. **/ 241 public function volume(vol:Number) {241 public function volume(vol:Number):void { 242 242 transform.volume = vol/100; 243 243 if(stream) { -
trunk/as3/com/jeroenwijering/models/SoundModel.as
r49 r57 37 37 38 38 /** Constructor; sets up the connection and display. **/ 39 public function SoundModel(mod:Model) {39 public function SoundModel(mod:Model):void { 40 40 model = mod; 41 41 transform = new SoundTransform(); … … 46 46 47 47 /** Sound completed; send event. **/ 48 private function completeHandler(evt:Event) {48 private function completeHandler(evt:Event):void { 49 49 clearInterval(interval); 50 50 position = model.playlist[model.config['item']]['start']; … … 55 55 56 56 /** Catch errors. **/ 57 private function errorHandler(evt:ErrorEvent) {57 private function errorHandler(evt:ErrorEvent):void { 58 58 model.sendEvent(ModelEvent.ERROR,{message:evt.text}); 59 59 stop(); … … 62 62 63 63 /** Load the sound. **/ 64 public function load() {64 public function load():void { 65 65 position = model.playlist[model.config['item']]['start']; 66 66 duration = model.playlist[model.config['item']]['duration']; … … 75 75 76 76 /** Pause the sound. **/ 77 public function pause() {77 public function pause():void { 78 78 clearInterval(interval); 79 79 channel.stop(); … … 83 83 84 84 /** Play the sound. **/ 85 public function play() {85 public function play():void { 86 86 channel = sound.play(position*1000,0,transform); 87 87 channel.removeEventListener(Event.SOUND_COMPLETE,completeHandler); … … 93 93 94 94 /** Interval for the loading progress **/ 95 private function progressHandler(evt:ProgressEvent) {95 private function progressHandler(evt:ProgressEvent):void { 96 96 var ldd = evt.bytesLoaded; 97 97 var ttl = evt.bytesTotal; … … 101 101 102 102 /** Change quality setting. **/ 103 public function quality(typ:Boolean) {};103 public function quality(typ:Boolean):void {}; 104 104 105 105 106 106 /** Seek in the sound. **/ 107 public function seek(pos:Number) {107 public function seek(pos:Number):void { 108 108 clearInterval(interval); 109 109 position = pos; … … 114 114 115 115 /** Destroy the sound. **/ 116 public function stop() {116 public function stop():void { 117 117 clearInterval(interval); 118 118 if(channel) { channel.stop(); } … … 124 124 125 125 /** Interval for the position progress **/ 126 private function timeHandler() {126 private function timeHandler():void { 127 127 position = Math.round(channel.position/100)/10; 128 128 var dur = Math.round(sound.length*sound.bytesTotal/sound.bytesLoaded/100)/10; … … 148 148 149 149 /** Set the volume level. **/ 150 public function volume(vol:Number) {150 public function volume(vol:Number):void { 151 151 transform.volume = vol/100; 152 152 if(channel) { -
trunk/as3/com/jeroenwijering/models/VideoModel.as
r53 r57 40 40 41 41 /** Constructor; sets up the connection and display. **/ 42 public function VideoModel(mod:Model) {42 public function VideoModel(mod:Model):void { 43 43 model = mod; 44 44 connection = new NetConnection(); … … 63 63 64 64 /** Catch security errors. **/ 65 private function errorHandler(evt:ErrorEvent) {65 private function errorHandler(evt:ErrorEvent):void { 66 66 model.sendEvent(ModelEvent.ERROR,{message:evt.text}); 67 67 }; … … 69 69 70 70 /** Load content. **/ 71 public function load() {71 public function load():void { 72 72 stream.play(model.playlist[model.config['item']]['file']); 73 73 loadinterval = setInterval(loadHandler,100); … … 78 78 79 79 /** Interval for the loading progress **/ 80 private function loadHandler() {80 private function loadHandler():void { 81 81 var ldd = stream.bytesLoaded; 82 82 var ttl = stream.bytesTotal; … … 89 89 90 90 /** Catch noncritical errors. **/ 91 private function metaHandler(evt:ErrorEvent) {91 private function metaHandler(evt:ErrorEvent):void { 92 92 model.sendEvent(ModelEvent.META,{error:evt.text}); 93 93 }; … … 95 95 96 96 /** Get metadata information from netstream class. **/ 97 public function onData(dat:Object) {97 public function onData(dat:Object):void { 98 98 if(dat.type == 'metadata' && !metadata) { 99 99 metadata = true; … … 114 114 115 115 /** Pause playback. **/ 116 public function pause() {116 public function pause():void { 117 117 clearInterval(timeinterval); 118 118 stream.pause(); … … 122 122 123 123 /** Resume playing. **/ 124 public function play() {124 public function play():void { 125 125 stream.resume(); 126 126 timeinterval = setInterval(timeHandler,100); … … 130 130 131 131 /** Change the smoothing mode. **/ 132 public function quality(qua:Boolean) {132 public function quality(qua:Boolean):void { 133 133 if(qua == true) { 134 134 video.smoothing = true; … … 142 142 143 143 /** Change the smoothing mode. **/ 144 public function seek(pos:Number) {144 public function seek(pos:Number):void { 145 145 clearInterval(timeinterval); 146 146 stream.seek(pos); … … 150 150 151 151 /** Receive NetStream status updates. **/ 152 private function statusHandler(evt:NetStatusEvent) {152 private function statusHandler(evt:NetStatusEvent):void { 153 153 if(evt.info.code == "NetStream.Play.Stop" && stream.bytesLoaded == stream.bytesTotal) { 154 154 clearInterval(timeinterval); … … 163 163 164 164 /** Destroy the video. **/ 165 public function stop() {165 public function stop():void { 166 166 if(stream.bytesLoaded != stream.bytesTotal) { 167 167 stream.close(); … … 175 175 176 176 /** Interval for the position progress **/ 177 private function timeHandler() {177 private function timeHandler():void { 178 178 var bfr = Math.round(stream.bufferLength/stream.bufferTime*100); 179 179 var pos = Math.round(stream.time*10)/10; … … 199 199 200 200 /** Set the volume level. **/ 201 public function volume(vol:Number) {201 public function volume(vol:Number):void { 202 202 transform.volume = vol/100; 203 203 stream.soundTransform = transform; -
trunk/as3/com/jeroenwijering/models/YoutubeModel.as
r38 r57 38 38 39 39 /** Setup YouTube connections and load proxy. **/ 40 public function YoutubeModel(mod:Model) {40 public function YoutubeModel(mod:Model):void { 41 41 model = mod; 42 42 outgoing = new LocalConnection(); … … 65 65 66 66 /** Catch load errors. **/ 67 private function errorHandler(evt:ErrorEvent) {67 private function errorHandler(evt:ErrorEvent):void { 68 68 model.sendEvent(ModelEvent.ERROR,{message:evt.text}); 69 69 }; … … 85 85 86 86 /** Load the YouTube movie. **/ 87 public function load() {87 public function load():void { 88 88 if(connected) { 89 89 model.sendEvent(ModelEvent.STATE,{newstate:ModelStates.BUFFERING}); … … 100 100 101 101 /** Pause the YouTube movie. **/ 102 public function pause() {102 public function pause():void { 103 103 outgoing.send("_AS3_to_AS2","pauseVideo"); 104 104 }; … … 107 107 108 108 /** Play or pause the video. **/ 109 public function play() {109 public function play():void { 110 110 outgoing.send("_AS3_to_AS2","playVideo"); 111 111 }; … … 113 113 114 114 /** SWF loaded; add it to the tree **/ 115 public function onSwfLoadComplete() {115 public function onSwfLoadComplete():void { 116 116 outgoing.send("_AS3_to_AS2","setSize",320,240); 117 117 model.config['mute'] == true ? volume(0): volume(model.config['volume']); … … 121 121 122 122 /** error was thrown without this handler **/ 123 public function onLocalConnectionStatusChange(evt:StatusEvent) {123 public function onLocalConnectionStatusChange(evt:StatusEvent):void { 124 124 // model.sendEvent(ModelEvent.META,{status:evt.code}); 125 125 }; … … 127 127 128 128 /** Catch youtube errors. **/ 129 public function onError(erc:String) {129 public function onError(erc:String):void { 130 130 var fil = model.playlist[model.config['item']]['file']; 131 131 model.sendEvent(ModelEvent.ERROR,{message:"YouTube error (video not found?):\n"+fil}); … … 135 135 136 136 /** Catch youtube state changes. **/ 137 public function onStateChange(stt:Number) {137 public function onStateChange(stt:Number):void { 138 138 switch(Number(stt)) { 139 139 case -1: … … 160 160 161 161 /** Catch Youtube load changes **/ 162 public function onLoadChange(ldd:Number,ttl:Number,off:Number) {162 public function onLoadChange(ldd:Number,ttl:Number,off:Number):void { 163 163 model.sendEvent(ModelEvent.LOADED,{loaded:ldd,total:ttl,offset:off}); 164 164 }; … … 166 166 167 167 /** Catch Youtube position changes **/ 168 public function onTimeChange(pos:Number,dur:Number) {168 public function onTimeChange(pos:Number,dur:Number):void { 169 169 model.sendEvent(ModelEvent.TIME,{position:pos,duration:dur}); 170 170 if(!metasent) { … … 176 176 177 177 /** Toggle quality (perhaps access the H264 versions later?). **/ 178 public function quality(stt:Boolean) {};178 public function quality(stt:Boolean):void {}; 179 179 180 180 181 181 /** Seek to position. **/ 182 public function seek(pos:Number) {182 public function seek(pos:Number):void { 183 183 outgoing.send("_AS3_to_AS2","seekTo",pos); 184 184 play(); … … 187 187 188 188 /** Destroy the youtube video. **/ 189 public function stop() {189 public function stop():void { 190 190 outgoing.send("_AS3_to_AS2","stopVideo"); 191 191 }; … … 194 194 195 195 /** Set the volume level. **/ 196 public function volume(pct:Number) {196 public function volume(pct:Number):void { 197 197 outgoing.send("_AS3_to_AS2","setVolume",pct); 198 198 }; -
trunk/as3/com/jeroenwijering/parsers/SMILParser.as
r14 r57 90 90 91 91 /** Get attributes from a SMIL element. **/ 92 public static function parseAttributes(obj:Object,itm:Object) {92 public static function parseAttributes(obj:Object,itm:Object):Object { 93 93 for(var i=0; i<obj.attributes().length(); i++) { 94 94 var att = String(obj.attributes()[i].name()); -
trunk/as3/com/jeroenwijering/player/Controller.as
r54 r57 33 33 34 34 /** Constructor, set up stage and playlist listeners. **/ 35 public function Controller(cfg:Object,skn:MovieClip) {35 public function Controller(cfg:Object,skn:MovieClip):void { 36 36 config = cfg; 37 37 skin = skn; … … 47 47 48 48 /** Register view and model with controller, start loading playlist. **/ 49 public function start(mdl:Model,vie:View) {49 public function start(mdl:Model,vie:View):void { 50 50 model= mdl; 51 51 model.addEventListener(ModelEvent.META,metaHandler); … … 78 78 79 79 /** Catch errors dispatched by the playlister. **/ 80 private function errorHandler(evt:ErrorEvent) {80 private function errorHandler(evt:ErrorEvent):void { 81 81 dispatchEvent(new ControllerEvent(ControllerEvent.ERROR,{message:evt.text})); 82 82 }; … … 84 84 85 85 /** Switch fullscreen state. **/ 86 private function fullscreenHandler(evt:ViewEvent) {86 private function fullscreenHandler(evt:ViewEvent):void { 87 87 if(skin.stage['displayState'] == 'fullScreen') { 88 88 skin.stage['displayState'] = 'normal'; … … 95 95 96 96 /** Set the fullscreen rectangle **/ 97 private function fullscreenrect() {97 private function fullscreenrect():void { 98 98 try { 99 99 skin.stage["fullScreenSourceRect"] = new Rectangle(0,0, … … 104 104 105 105 /** Jump to a userdefined item in the playlist. **/ 106 private function itemHandler(evt:ViewEvent) {106 private function itemHandler(evt:ViewEvent):void { 107 107 var itm = evt.data.index; 108 108 if (itm < 0) { … … 117 117 118 118 /** Jump to the link of a playlistitem. **/ 119 private function linkHandler(evt:ViewEvent) {119 private function linkHandler(evt:ViewEvent):void { 120 120 var itm = evt.data.index; 121 121 if (itm == undefined) { … … 130 130 131 131 /** Load a new playlist. **/ 132 private function loadHandler(evt:ViewEvent) {132 private function loadHandler(evt:ViewEvent):void { 133 133 stopHandler(); 134 134 try { … … 142 142 143 143 /** Update playlist item duration. **/ 144 private function metaHandler(evt:ModelEvent) {144 private function metaHandler(evt:ModelEvent):void { 145 145 if(evt.data.duration) { 146 146 var dur = Math.round(evt.data.duration*10)/10 … … 151 151 152 152 /** Save new state of the mute switch and send volume. **/ 153 private function muteHandler(evt:ViewEvent) {153 private function muteHandler(evt:ViewEvent):void { 154 154 if(evt.data.state) { 155 155 if(evt.data.state == config['mute']) { … … 166 166 167 167 /** Jump to the next item in the playlist. **/ 168 private function nextHandler(evt:ViewEvent) {168 private function nextHandler(evt:ViewEvent):void { 169 169 if(playlist && config['shuffle'] == true) { 170 170 playItem(randomizer.pick()); … … 178 178 179 179 /** Change the playback state. **/ 180 private function playHandler(evt:ViewEvent) {180 private function playHandler(evt:ViewEvent):void { 181 181 if(playlist) { 182 182 if(evt.data.state != false && config['state'] == ModelStates.PAUSED) { … … 195 195 196 196 /** Direct the model to play a new item. **/ 197 private function playItem(nbr:Number=undefined) {197 private function playItem(nbr:Number=undefined):void { 198 198 if(nbr > -1) { 199 199 if(playlist[nbr]['file'] == playlist[config['item']]['file']) { … … 207 207 208 208 /** Manage loading of a new playlist. **/ 209 private function playlistHandler(evt:Event) {209 private function playlistHandler(evt:Event):void { 210 210 if(config['shuffle'] == true) { 211 211 randomizer = new Randomizer(playlist.length); … … 222 222 223 223 /** Jump to the previous item in the playlist. **/ 224 private function prevHandler(evt:ViewEvent) {224 private function prevHandler(evt:ViewEvent):void { 225 225 if (config['item'] == 0) { 226 226 playItem(playlist.length-1); … … 232 232 233 233 /** Switch playback quality. **/ 234 private function qualityHandler(evt:ViewEvent=null) {234 private function qualityHandler(evt:ViewEvent=null):void { 235 235 if(evt.data.state != undefined) { 236 236 if(evt.data.state == config['quality']) { … … 248 248 249 249 /** Forward a resizing of the stage. **/ 250 private function resizeHandler(evt:ViewEvent) {250 private function resizeHandler(evt:ViewEvent):void { 251 251 var mgn = config['margins'].split(','); 252 252 var dat = { … … 277 277 278 278 /** Seek to a specific part in a mediafile. **/ 279 private function seekHandler(evt:ViewEvent) {279 private function seekHandler(evt:ViewEvent):void { 280 280 if(config['state'] != ModelStates.IDLE && playlist[config['item']]['duration'] > 0) { 281 281 var pos = evt.data.position; … … 291 291 292 292 /** Stop all playback and buffering. **/ 293 private function stopHandler(evt:ViewEvent=undefined) {293 private function stopHandler(evt:ViewEvent=undefined):void { 294 294 dispatchEvent(new ControllerEvent(ControllerEvent.STOP)); 295 295 }; … … 297 297 298 298 /** Manage playback state changes. **/ 299 private function stateHandler(evt:ModelEvent) {299 private function stateHandler(evt:ModelEvent):void { 300 300 if(evt.data.newstate == ModelStates.COMPLETED && (config['repeat'] == 'always' || 301 301 (config['repeat'] == 'list' && config['shuffle'] == true && randomizer.length > 0) || … … 313 313 314 314 /** Save new state of the mute switch and send volume. **/ 315 private function volumeHandler(evt:ViewEvent) {315 private function volumeHandler(evt:ViewEvent):void { 316 316 var vol = evt.data.percentage; 317 317 if (vol < 1) { -
trunk/as3/com/jeroenwijering/player/Model.as
r54 r57 36 36 37 37 /** Constructor, save arrays and set currentItem. **/ 38 public function Model(cfg:Object,skn:MovieClip,ctr:Controller) {38 public function Model(cfg:Object,skn:MovieClip,ctr:Controller):void { 39 39 config = cfg; 40 40 skin = skn; … … 57 57 58 58 /** Item change: switch the curently active model if there's a new URL **/ 59 private function itemHandler(evt:ControllerEvent) {59 private function itemHandler(evt:ControllerEvent):void { 60 60 var typ = playlist[evt.data.index]['type']; 61 61 var url = playlist[evt.data.index]['file']; … … 83 83 84 84 /** Setup a new model. **/ 85 private function loadModel(typ:String) {85 private function loadModel(typ:String):void { 86 86 switch(typ) { 87 87 case 'camera': … … 117 117 118 118 /** Place a loaded mediafile on stage **/ 119 public function mediaHandler(chd:DisplayObject=undefined) {119 public function mediaHandler(chd:DisplayObject=undefined):void { 120 120 var obj = skin.display.media; 121 121 Draw.clear(obj); … … 130 130 131 131 /** Load the configuration array. **/ 132 private function muteHandler(evt:ControllerEvent) {132 private function muteHandler(evt:ControllerEvent):void { 133 133 if(currentModel && evt.data.state == true) { 134 134 models[currentModel].volume(0); … … 140 140 141 141 /** Togge the playback state. **/ 142 private function playHandler(evt:ControllerEvent) {142 private function playHandler(evt:ControllerEvent):void { 143 143 if(currentModel) { 144 144 if(evt.data.state == true) { … … 152 152 153 153 /** Send an idle with new playlist. **/ 154 private function playlistHandler(evt:ControllerEvent) {154 private function playlistHandler(evt:ControllerEvent):void { 155 155 if(currentModel) { 156 156 stopHandler(); … … 163 163 164 164 /** Toggle the playback quality. **/ 165 private function qualityHandler(evt:ControllerEvent) {165 private function qualityHandler(evt:ControllerEvent):void { 166 166 if(currentModel) { 167 167 models[currentModel].quality(evt.data.state); … … 171 171 172 172 /** Resize the media and thumb. **/ 173 private function resizeHandler(evt:ControllerEvent) {173 private function resizeHandler(evt:ControllerEvent):void { 174 174 Stretcher.stretch(skin.display.media,evt.data.width,evt.data.height,config['stretching']); 175 175 }; … … 177 177 178 178 /** Seek inside a file. **/ 179 private function seekHandler(evt:ControllerEvent) {179 private function seekHandler(evt:ControllerEvent):void { 180 180 if(currentModel) { 181 181 models[currentModel].seek(evt.data.position); … … 185 185 186 186 /** Load the configuration array. **/ 187 private function stopHandler(evt:ControllerEvent=undefined) {187 private function stopHandler(evt:ControllerEvent=undefined):void { 188 188 currentURL = undefined; 189 189 if(currentModel) { … … 197 197 198 198 /** Dispatch events. State switch is saved. **/ 199 public function sendEvent(typ:String,dat:Object) {199 public function sendEvent(typ:String,dat:Object):void { 200 200 if(typ == ModelEvent.STATE && dat.newstate != config['state']) { 201 201 dat.oldstate = config['state']; … … 215 215 216 216 /** Load a thumb on stage. **/ 217 private function thumbLoader() {217 private function thumbLoader():void { 218 218 var img = playlist[config['item']]['image']; 219 219 if(img) { … … 223 223 224 224 /** Place a loaded thumb on stage. **/ 225 private function thumbHandler(evt:Event=null) {225 private function thumbHandler(evt:Event=null):void { 226 226 mediaHandler(loader); 227 227 }; … … 229 229 230 230 /** Load the configuration array. **/ 231 private function volumeHandler(evt:ControllerEvent) {231 private function volumeHandler(evt:ControllerEvent):void { 232 232 if(currentModel) { 233 233 models[currentModel].volume(evt.data.percentage); -
trunk/as3/com/jeroenwijering/player/Player.as
r56 r57 63 63 token:undefined, 64 64 tracecall:undefined, 65 version:'4.1.5 5'65 version:'4.1.56' 66 66 }; 67 67 /** Object that loads all configuration variables. **/ … … 80 80 81 81 /** Constructor; Loads config parameters. **/ 82 public function Player() {82 public function Player():void { 83 83 visible = false; 84 84 plugins = new Array(); … … 90 90 91 91 /** Config loading completed; now load skin. **/ 92 private function configHandler(evt:Event) {92 private function configHandler(evt:Event):void { 93 93 loader = new SWFLoader(this); 94 94 loader.addEventListener(Event.INIT,skinHandler); … … 99 99 100 100 /** Skin loading completed, now load MVC and plugins. **/ 101 private function skinHandler(evt:Event) {101 private function skinHandler(evt:Event):void { 102 102 controller = new Controller(configger.config,loader.skin); 103 103 model = new Model(configger.config,loader.skin,controller); … … 116 116 * @prm plg Any object that implements the PluginInterface. 117 117 **/ 118 public function addPlugin(plg:Object) {118 public function addPlugin(plg:Object):void { 119 119 plugins.push(plg); 120 120 }; … … 122 122 123 123 /** Plugin loading completed; let's start! **/ 124 private function pluginHandler(evt:Event=null) {124 private function pluginHandler(evt:Event=null):void { 125 125 for(var i=0; i<plugins.length; i++) { plugins[i].initializePlugin(_view); } 126 126 controller.start(model,_view); -
trunk/as3/com/jeroenwijering/player/SWFLoader.as
r52 r57 35 35 * @param ply The player instance. 36 36 **/ 37 public function SWFLoader(ply:MovieClip) {37 public function SWFLoader(ply:MovieClip):void { 38 38 player = ply; 39 39 amount = 0; … … 46 46 * @prm pgi A commaseparated list with plugins. 47 47 **/ 48 public function loadPlugins(pgi:String=null) {48 public function loadPlugins(pgi:String=null):void { 49 49 if(pgi) { 50 50 var arr = pgi.split(','); … … 62 62 * @param cfg Object that contains all configuration parameters. 63 63 **/ 64 public function loadSkin(skn:String=null) {64 public function loadSkin(skn:String=null):void { 65 65 if(skn) { 66 66 loadSWF(skn,true); … … 73 73 74 74 /** Load a particular SWF file. **/ 75 public function loadSWF(str:String,skn:Boolean) {75 public function loadSWF(str:String,skn:Boolean):void { 76 76 if(str.substr(-4) != '.swf') { str += '.swf'; } 77 77 var ldr = new Loader(); … … 98 98 99 99 /** SWF loading failed; use default skin. **/ 100 private function pluginError(evt:IOErrorEvent) {100 private function pluginError(evt:IOErrorEvent):void { 101 101 amount--; 102 102 if (amount == 0) { … … 107 107 108 108 /** Plugin loading completed; add to stage and populate. **/ 109 private function pluginHandler(evt:Event) {109 private function pluginHandler(evt:Event):void { 110 110 var clp = evt.target.content; 111 111 player.addPlugin(clp); … … 118 118 119 119 /** SWF loading failed; use default skin. **/ 120 private function skinError(evt:IOErrorEvent=null) {120 private function skinError(evt:IOErrorEvent=null):void { 121 121 skin = player['player']; 122 122 dispatchEvent(new Event(Event.INIT)); … … 125 125 126 126 /** Skin loading completed; add to stage and populate. **/ 127 private function skinHandler(evt:Event) {127 private function skinHandler(evt:Event):void { 128 128 var clp = evt.target.content; 129 129 if(clp['player']) { -
trunk/as3/com/jeroenwijering/player/View.as
r54 r57 36 36 37 37 /** Constructor, save references and subscribe to events. **/ 38 public function View(cfg:Object,skn:MovieClip,ctr:Controller,mdl:Model) {38 public function View(cfg:Object,skn:MovieClip,ctr:Controller,mdl:Model):void { 39 39 _config = cfg; 40 40 _config['client'] = 'FLASH '+Capabilities.version; … … 77 77 78 78 /** jump to the about page. **/ 79 private function aboutSetter(evt:ContextMenuEvent) {79 private function aboutSetter(evt:ContextMenuEvent):void { 80 80 navigateToURL(new URLRequest(config['aboutlink']),'_blank'); 81 81 }; … … 83 83 84 84 /** Subscribers to the controller and model. **/ 85 override public function addControllerListener(typ:String,fcn:Function) {85 override public function addControllerListener(typ:String,fcn:Function):void { 86 86 controller.addEventListener(typ.toUpperCase(),fcn); 87 87 }; … … 90 90 return true; 91 91 }; 92 override public function addModelListener(typ:String,fcn:Function) {92 override public function addModelListener(typ:String,fcn:Function):void { 93 93 model.addEventListener(typ.toUpperCase(),fcn); 94 94 }; … … 97 97 return true; 98 98 }; 99 override public function addViewListener(typ:String,fcn:Function) {99 override public function addViewListener(typ:String,fcn:Function):void { 100 100 this.addEventListener(typ.toUpperCase(),fcn); 101 101 }; … … 107 107 108 108 /** Send event to listeners and tracers. **/ 109 private function forward(tgt:String,typ:String,dat:Object) {109 private function forward(tgt:String,typ:String,dat:Object):void { 110 110 var prm = ''; 111 111 for (var i in dat) { prm += i+':'+dat[i]+','; } … … 131 131 132 132 /** Toggle the fullscreen mode. **/ 133 private function fullscreenSetter(evt:ContextMenuEvent) { sendEvent('fullscreen'); };133 private function fullscreenSetter(evt:ContextMenuEvent):void { sendEvent('fullscreen'); }; 134 134 135 135 136 136 /** Add a custom menu item. **/ 137 private function menuAdd(itm:ContextMenuItem,hdl:Function) {137 private function menuAdd(itm:ContextMenuItem,hdl:Function):void { 138 138 itm.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,hdl); 139 139 itm.separatorBefore = true; … … 143 143 144 144 /** Set the rightclick menu. **/ 145 private function menuSet() {145 private function menuSet():void { 146 146 context = new ContextMenu(); 147 147 context.hideBuiltInItems(); … … 169 169 170 170 /** Send a call to javascript that the player is ready. **/ 171 private function playerReady() {171 private function playerReady():void { 172 172 var dat = { 173 173 id:config['id'], … … 182 182 183 183 /** Toggle the smoothing mode. **/ 184 private function qualityHandler(evt:ControllerEvent) {184 private function qualityHandler(evt:ControllerEvent):void { 185 185 if(evt.data.state == true) { 186 186 context.customItems[0].caption = "Switch to low quality"; … … 192 192 193 193 /** Toggle the smoothing mode. **/ 194 private function qualitySetter(evt:ContextMenuEvent) { sendEvent('quality'); };194 private function qualitySetter(evt:ContextMenuEvent):void { sendEvent('quality'); }; 195 195 196 196 197 197 /** Set the fullscreen menubutton. **/ 198 private function resizeHandler(evt:ControllerEvent) {198 private function resizeHandler(evt:ControllerEvent):void { 199 199 if(evt.data.fullscreen == false) { 200 200 context.customItems[1].caption = "Switch to fullscreen"; … … 206 206 207 207 /** Forward a resizing of the stage. **/ 208 private function resizeSetter(evt:Event=undefined) {208 private function resizeSetter(evt:Event=undefined):void { 209 209 var dat = { 210 210 height:_skin.stage.stageHeight, … … 216 216 217 217 /** Dispatch events. **/ 218 override public function sendEvent(typ:String,prm:Object=undefined) {218 override public function sendEvent(typ:String,prm:Object=undefined):void { 219 219 typ = typ.toUpperCase(); 220 220 var dat = new Object(); … … 257 257 258 258 /** Forward events to tracer and subscribers. **/ 259 private function setController(evt:ControllerEvent) { forward('CONTROLLER',evt.type,evt.data); };260 private function setModel(evt:ModelEvent) { forward('MODEL',evt.type,evt.data); };261 private function setView(evt:ViewEvent) { forward('VIEW',evt.type,evt.data); };259 private function setController(evt:ControllerEvent):void { forward('CONTROLLER',evt.type,evt.data); }; 260 private function setModel(evt:ModelEvent):void { forward('MODEL',evt.type,evt.data); }; 261 private function setView(evt:ViewEvent):void { forward('VIEW',evt.type,evt.data); }; 262 262 263 263 264 264 /** Setup listeners to all events for tracing / javascript. **/ 265 private function setListening() {265 private function setListening():void { 266 266 addControllerListener(ControllerEvent.ERROR,setController); 267 267 addControllerListener(ControllerEvent.ITEM,setController); -
trunk/as3/com/jeroenwijering/plugins/Captions.as
r56 r57 36 36 37 37 38 public function Captions() {};38 public function Captions():void {}; 39 39 40 40 41 41 /** Initing the plugin. **/ 42 public function initializePlugin(vie:AbstractView) {42 public function initializePlugin(vie:AbstractView):void { 43 43 view = vie; 44 44 if(!view.skin['captions']) { return; } … … 56 56 57 57 /** Check for captions with a new item. **/ 58 private function itemHandler(evt:ControllerEvent) {58 private function itemHandler(evt:ControllerEvent):void { 59 59 current = -1; 60 60 setCaption(''); … … 74 74 75 75 /** Captions are loaded; now display them. **/ 76 private function loaderHandler(evt:Event) {76 private function loaderHandler(evt:Event):void { 77 77 try { 78 78 var dat = XML(evt.target.data); … … 91 91 92 92 /** Resize the captions if the display changes. **/ 93 private function resizeHandler(evt:ControllerEvent=undefined) {93 private function resizeHandler(evt:ControllerEvent=undefined):void { 94 94 clip.back.height = clip.field.height+15; 95 95 clip.width = view.config['width']; … … 100 100 101 101 /** Catch and display captions that are sent through metadata. **/ 102 private function metaHandler(evt:ModelEvent) {102 private function metaHandler(evt:ModelEvent):void { 103 103 if (evt.data.text != undefined && evt.data.trackid != undefined) { 104 104 setCaption(evt.data.text); … … 110 110 111 111 /** Set a caption on screen. **/ 112 private function setCaption(txt:String) {112 private function setCaption(txt:String):void { 113 113 clip.visible = true; 114 114 clip.field.htmlText = txt; … … 118 118 119 119 /** Check the playback state; hide captions if not playing. **/ 120 private function stateHandler(evt:ModelEvent) {120 private function stateHandler(evt:ModelEvent):void { 121 121 if(view.config['caption'] == true) { 122 122 clip.visible = true; … … 128 128 129 129 /** Check timing of the player to sync captions. **/ 130 private function timeHandler(evt:ModelEvent) {130 private function timeHandler(evt:ModelEvent):void { 131 131 var cur = -1; 132 132 var pos = evt.data.position; -
trunk/as3/com/jeroenwijering/plugins/Controlbar.as
r56 r57 56 56 57 57 /** Constructor. **/ 58 public function Controlbar() {};58 public function Controlbar():void {}; 59 59 60 60 61 61 /** Initialize from view. **/ 62 public function initializePlugin(vie:AbstractView) {62 public function initializePlugin(vie:AbstractView):void { 63 63 view = vie; 64 64 view.addControllerListener(ControllerEvent.RESIZE,resizeHandler); … … 86 86 87 87 /** Handle clicks from all buttons. **/ 88 private function clickHandler(evt:MouseEvent) {88 private function clickHandler(evt:MouseEvent):void { 89 89 view.sendEvent(BUTTONS[evt.target.name]); 90 90 }; … … 92 92 93 93 /** Handle mouse presses on sliders. **/ 94 private function downHandler(evt:MouseEvent) {94 private function downHandler(evt:MouseEvent):void { 95 95 var tgt = evt.target; 96 96 var rct = new Rectangle(tgt.rail.x,tgt.icon.y,tgt.rail.width-tgt.icon.width,0); … … 102 102 103 103 /** Fix the timeline display. **/ 104 private function fixTime() {104 private function fixTime():void { 105 105 try { 106 106 var scp = bar.timeSlider.scaleX; … … 115 115 116 116 /** Handle a change in the current item **/ 117 private function itemHandler(evt:ControllerEvent=null) {117 private function itemHandler(evt:ControllerEvent=null):void { 118 118 try { 119 119 if(view.playlist && view.playlist.length > 1) { … … 137 137 138 138 /** Process bytesloaded updates given by the model. **/ 139 private function loadedHandler(evt:ModelEvent=null) {139 private function loadedHandler(evt:ModelEvent=null):void { 140 140 var pc1 = 0; 141 141 if(evt && evt.data.total > 0) { … … 155 155 156 156 /** Show above controlbar on mousemove. **/ 157 private function moveHandler(evt:MouseEvent=null) {157 private function moveHandler(evt:MouseEvent=null):void { 158 158 if(bar.alpha == 0) { Animations.fade(bar,1); } 159 159 clearTimeout(hiding); … … 164 164 165 165 /** Hide above controlbar again when move has timed out. **/ 166 private function moveTimeout() {166 private function moveTimeout():void { 167 167 if((bar.mouseY<0 || bar.mouseY>bar.height) && bar.alpha == 1) { 168 168 Animations.fade(bar,0); … … 173 173 174 174 /** Show a mute icon if playing. **/ 175 private function muteHandler(evt:ControllerEvent=null) {175 private function muteHandler(evt:ControllerEvent=null):void { 176 176 try { 177 177 if(view.config['mute'] == true) { … … 191 191 192 192 /** Handle mouseouts from all buttons **/ 193 private function outHandler(evt:MouseEvent) {193 private function outHandler(evt:MouseEvent):void { 194 194 if(front) { 195 195 bar[evt.target.name]['icon'].transform.colorTransform = front; … … 201 201 202 202 /** Handle clicks from all buttons **/ 203 private function overHandler(evt:MouseEvent) {203 private function overHandler(evt:MouseEvent):void { 204 204 if(light) { 205 205 bar[evt.target.name]['icon'].transform.colorTransform = light; … … 211 211 212 212 /** Process resizing requests **/ 213 private function resizeHandler(evt:ControllerEvent=null) {213 private function resizeHandler(evt:ControllerEvent=null):void { 214 214 var wid = stacker.width; 215 215 if(view.config['controlbar'] == 'over' || (evt && evt.data.fullscreen == true)) { … … 256 256 257 257 /** Clickhandler for all buttons. **/ 258 private function setButtons() {258 private function setButtons():void { 259 259 for(var btn in BUTTONS) { 260 260 if(bar[btn]) { … … 279 279 280 280 /** Init the colors. **/ 281 private function setColors() {281 private function setColors():void { 282 282 if(view.config['backcolor']) { 283 283 var clr = new ColorTransform(); … … 313 313 314 314 /** Process state changes **/ 315 private function stateHandler(evt:ModelEvent=undefined) {315 private function stateHandler(evt:ModelEvent=undefined):void { 316 316 clearTimeout(hiding); 317 317 view.skin.removeEventListener(MouseEvent.MOUSE_MOVE,moveHandler); … … 347 347 348 348 /** Process time updates given by the model. **/ 349 private function timeHandler(evt:ModelEvent=null) {349 private function timeHandler(evt:ModelEvent=null):void { 350 350 var dur = 0; 351 351 var pos = 0; … … 380 380 381 381 /** Handle mouse releases on sliders. **/ 382 private function upHandler(evt:MouseEvent) {382 private function upHandler(evt:MouseEvent):void { 383 383 var tgt = evt.target; 384 384 var mpl = 0; … … 397 397 398 398 /** Reflect the new volume in the controlbar **/ 399 private function volumeHandler(evt:ControllerEvent=null) {399 private function volumeHandler(evt:ControllerEvent=null):void { 400 400 try { 401 401 var vsl = bar.volumeSlider; -
trunk/as3/com/jeroenwijering/plugins/Display.as
r56 r57 43 43 44 44 /** Constructor; add all needed listeners. **/ 45 public function Display() {};45 public function Display():void {}; 46 46 47 47 48 48 /** Initialize the plugin. **/ 49 public function initializePlugin(vie:AbstractView) {49 public function initializePlugin(vie:AbstractView):void { 50 50 view = vie; 51 51 view.addControllerListener(ControllerEvent.ERROR,errorHandler); … … 77 77 78 78 /** Receive buffer updates. **/ 79 private function bufferHandler(evt:ModelEvent) {79 private function bufferHandler(evt:ModelEvent):void { 80 80 var pct = ''; 81 81 if(evt.data.percentage > 0) { … … 89 89 90 90 /** Process a click on the display. **/ 91 private function clickHandler(evt:MouseEvent) {91 private function clickHandler(evt:MouseEvent):void { 92 92 view.sendEvent(view.config['displayclick']); 93 93 }; … … 95 95 96 96 /** Receive and print errors. **/ 97 private function errorHandler(evt:Object) {97 private function errorHandler(evt:Object):void { 98 98 setIcon('errorIcon'); 99 99 try { … … 104 104 105 105 /** Logo loaded; now position it. **/ 106 private function logoHandler(evt:Event) {106 private function logoHandler(evt:Event):void { 107 107 if(margins[0] > margins[2]) { 108 108 display.logo.x = display.back.width- margins[2]-display.logo.width; … … 119 119 120 120 /** Receive resizing requests **/ 121 private function resizeHandler(evt:ControllerEvent=null) {121 private function resizeHandler(evt:ControllerEvent=null):void { 122 122 var wid = view.config['width']; 123 123 var hei = view.config['height']; … … 146 146 147 147 /** Set a specific icon in the display. **/ 148 private function setIcon(icn:String=undefined) {148 private function setIcon(icn:String=undefined):void { 149 149 for(var i in ICONS) { 150 150 if(display[ICONS[i]]) { … … 160 160 161 161 /** Setup the logo loading. **/ 162 private function setLogo() {162 private function setLogo():void { 163 163 margins = new Array( 164 164 display.logo.x, … … 175 175 176 176 /** Handle a change in playback state. **/ 177 private function stateHandler(evt:ModelEvent=null) {177 private function stateHandler(evt:ModelEvent=null):void { 178 178 state = view.config['state']; 179 179 if(state == ModelStates.PLAYING) { -
trunk/as3/com/jeroenwijering/plugins/Playlist.as
r56 r57 45 45 46 46 47 public function Playlist() {};47 public function Playlist():void {}; 48 48 49 49 50 50 /** Initialize the communication with the player. **/ 51 public function initializePlugin(vie:AbstractView) {51 public function initializePlugin(vie:AbstractView):void { 52 52 view = vie; 53 53 view.addControllerListener(ControllerEvent.ITEM,itemHandler); … … 78 78 79 79 /** Setup all buttons in the playlist **/ 80 private function buildList(clr:Boolean) {80 private function buildList(clr:Boolean):void { 81 81 if(!view.playlist) { return; } 82 82 var wid = clip.back.width; … … 118 118 119 119 /** Setup the scrollbar component **/ 120 private function buildSlider() {120 private function buildSlider():void { 121 121 var scr = clip.slider; 122 122 scr.visible = true; … … 130 130 131 131 /** Handle a click on a button. **/ 132 private function clickHandler(evt:MouseEvent) {132 private function clickHandler(evt:MouseEvent):void { 133 133 view.sendEvent('item',Number(evt.target.name)); 134 134 }; … … 136 136 137 137 /** Switch the currently active item */ 138 private function itemHandler(evt:ControllerEvent) {138 private function itemHandler(evt:ControllerEvent):void { 139 139 var idx = view.config['item']; 140 140 if(buttons[idx]) { … … 156 156 157 157 /** Loading of image completed; resume loading **/ 158 private function loaderHandler(evt:Event) {158 private function loaderHandler(evt:Event):void { 159 159 var ldr = Loader(evt.target.loader); 160 160 Stretcher.stretch(ldr,image[0],image[1],Stretcher.EXACTFIT); … … 163 163 164 164 /** Handle a button rollover. **/ 165 private function overHandler(evt:MouseEvent) {165 private function overHandler(evt:MouseEvent):void { 166 166 var idx = Number(evt.target.name); 167 167 if(light) { … … 178 178 179 179 /** Handle a button rollover. **/ 180 private function outHandler(evt:MouseEvent) {180 private function outHandler(evt:MouseEvent):void { 181 181 var idx = Number(evt.target.name); 182 182 if(front) { … … 195 195 196 196 /** New playlist loaded: rebuild the playclip. **/ 197 private function playlistHandler(evt:ControllerEvent) {197 private function playlistHandler(evt:ControllerEvent):void { 198 198 active = undefined; 199 199 if(view.config['playlist'] != 'none') { … … 204 204 205 205 /** Process resizing requests **/ 206 private function resizeHandler(evt:ControllerEvent) {206 private function resizeHandler(evt:ControllerEvent):void { 207 207 if(view.config['playlist'] == 'right') { 208 208 clip.x = evt.data.width; … … 232 232 233 233 /** Make sure the playlist is not out of range. **/ 234 private function scrollCheck() {234 private function scrollCheck():void { 235 235 var scr = clip.slider; 236 236 if(clip.list.y > 0 || scr.icon.y < scr.rail.y) { … … 246 246 247 247 /** Scrolling handler. **/ 248 private function scrollHandler() {248 private function scrollHandler():void { 249 249 var scr = clip.slider; 250 250 var yps = scr.mouseY; … … 258 258 259 259 /** Init the colors. **/ 260 private function setColors() {260 private function setColors():void { 261 261 if(view.config['backcolor']) { 262 262 back = new ColorTransform(); … … 280 280 281 281 /** Setup button elements **/ 282 private function setContents(idx:Number) {282 private function setContents(idx:Number):void { 283 283 for (var itm in view.playlist[idx]) { 284 284 if(!buttons[idx].c[itm]) { … … 323 323 324 324 /** Start scrolling the playlist on mousedown. **/ 325 private function sdownHandler(evt:MouseEvent) {325 private function sdownHandler(evt:MouseEvent):void { 326 326 clearInterval(scrollInterval); 327 327 clip.stage.addEventListener(MouseEvent.MOUSE_UP,supHandler); … … 332 332 333 333 /** Revert the highlight on mouseout. **/ 334 private function soutHandler(evt:MouseEvent) {334 private function soutHandler(evt:MouseEvent):void { 335 335 if(front) { 336 336 clip.slider.icon.transform.colorTransform = front; … … 342 342 343 343 /** Highlight the icon on rollover. **/ 344 private function soverHandler(evt:MouseEvent) {344 private function soverHandler(evt:MouseEvent):void { 345 345 if(light) { 346 346 clip.slider.icon.transform.colorTransform = light; … … 352 352 353 353 /** Stop scrolling the playlist on mouseout. **/ 354 private function supHandler(evt:MouseEvent) {354 private function supHandler(evt:MouseEvent):void { 355 355 clearInterval(scrollInterval); 356 356 clip.stage.removeEventListener(MouseEvent.MOUSE_UP,supHandler); … … 359 359 360 360 /** Process state changes **/ 361 private function stateHandler(evt:ModelEvent) {361 private function stateHandler(evt:ModelEvent):void { 362 362 if(view.config['playlist'] == 'over') { 363 363 if(evt.data.newstate == ModelStates.PLAYING || … … 372 372 373 373 /** Process mousewheel usage. **/ 374 private function wheelHandler(evt:MouseEvent) {};374 private function wheelHandler(evt:MouseEvent):void {}; 375 375 376 376 -
trunk/as3/com/jeroenwijering/utils/Animations.as
r54 r57 21 21 * @param spd The amount of alpha change per frame. 22 22 **/ 23 public static function fade(tgt:MovieClip,end:Number=1,spd:Number=0.2) {23 public static function fade(tgt:MovieClip,end:Number=1,spd:Number=0.2):void { 24 24 if(tgt.alpha > end) { 25 25 tgt.spd = -Math.abs(spd); … … 33 33 34 34 /** The fade enterframe function. **/ 35 private static function fadeHandler(evt:Event) {35 private static function fadeHandler(evt:Event):void { 36 36 var tgt = MovieClip(evt.target); 37 37 if((tgt.alpha >= tgt.end-tgt.spd && tgt.spd > 0) || … … 55 55 * @param spd The movement speed (1 - 2). 56 56 **/ 57 public static function ease(tgt:MovieClip,xps:Number,yps:Number,spd:Number=2) {57 public static function ease(tgt:MovieClip,xps:Number,yps:Number,spd:Number=2):void { 58 58 if(!xps) { tgt.xps = tgt.x; } else { tgt.xps = xps; } 59 59 if(!yps) { tgt.yps = tgt.y; } else { tgt.yps = yps; } … … 64 64 65 65 /** The ease enterframe function. **/ 66 private static function easeHandler(evt:Event) {66 private static function easeHandler(evt:Event):void { 67 67 var tgt = MovieClip(evt.target); 68 68 if(Math.abs(tgt.x - tgt.xps) < 1 && Math.abs(tgt.y - tgt.yps) < 1) { … … 84 84 * @param spd The speed of typing (1 - 2). 85 85 **/ 86 public static function write(tgt:MovieClip,str:String,spd:Number=1.5) {86 public static function write(tgt:MovieClip,str:String,spd:Number=1.5):void { 87 87 tgt.str = str; 88 88 tgt.spd = spd; … … 93 93 94 94 /** The write enterframe function. **/ 95 private static function writeHandler(evt:Event) {95 private static function writeHandler(evt:Event):void { 96 96 var tgt = MovieClip(evt.target); 97 97 var dif = Math.floor((tgt.str.length-tgt.tf.text.length)/tgt.spd); -
trunk/as3/com/jeroenwijering/utils/Configger.as
r49 r57 26 26 27 27 /** Constructor; nothing fancy. **/ 28 public function Configger(ref:Sprite) {28 public function Configger(ref:Sprite):void { 29 29 reference = ref; 30 30 }; … … 36 36 * @param def The config object to overwrite new data in. 37 37 **/ 38 public function load(def:Object) {38 public function load(def:Object):void { 39 39 config = def; 40 40 var xml = reference.root.loaderInfo.parameters['config']; … … 48 48 49 49 /** Load configuration data from external XML file. **/ 50 private function loadXML(url:String) {50 private function loadXML(url:String):void { 51 51 loader = new URLLoader(); 52 52 loader.addEventListener(Event.COMPLETE,xmlHandler); … … 58 58 59 59 /** Parse the XML list **/ 60 private function xmlHandler(evt:Event) {60 private function xmlHandler(evt:Event):void { 61 61 var dat = XML(evt.currentTarget.data); 62 62 var obj = new Object(); … … 70 70 71 71 /** Set config variables or load them from flashvars. **/ 72 private function loadFlashvars() {72 private function loadFlashvars():void { 73 73 compareWrite(reference.root.loaderInfo.parameters); 74 74 dispatchEvent(new Event(Event.COMPLETE)); … … 77 77 78 78 /** Compare and save new items in config, preserving datatype. **/ 79 private function compareWrite(obj:Object) {79 private function compareWrite(obj:Object):void { 80 80 for(var cfv in obj) { 81 81 var lfv = cfv.toLowerCase(); -
trunk/as3/com/jeroenwijering/utils/Draw.as
r48 r57 19 19 * @param tgt Displayobject to clear. 20 20 **/ 21 public static function clear(tgt:Sprite) {21 public static function clear(tgt:Sprite):void { 22 22 var len = tgt.numChildren; 23 23 for(var i=0; i<len; i++) { -
trunk/as3/com/jeroenwijering/utils/NetClient.as
r54 r57 13 13 14 14 /** Constructor. **/ 15 public function NetClient(cbk:Object) {15 public function NetClient(cbk:Object):void { 16 16 callback = cbk; 17 17 }; … … 19 19 20 20 /** Forward calls to callback **/ 21 private function forward(dat:Object) {21 private function forward(dat:Object):void { 22 22 callback.onData(dat); 23 23 }; … … 25 25 26 26 /** Handler for captionate events. **/ 27 public function onBWDone() {27 public function onBWDone():void { 28 28 var dat = {type:'bwdone'}; 29 29 forward(dat); … … 32 32 33 33 /** Handler for captionate events. **/ 34 public function onCaption(cps:String,spk:Number) {34 public function onCaption(cps:String,spk:Number):void { 35 35 var dat = {type:'caption',captions:cps,speaker:spk}; 36 36 forward(dat); … … 39 39 40 40 /** Handler for captionate events. **/ 41 public function onCaptionInfo(obj:Object) {41 public function onCaptionInfo(obj:Object):void { 42 42 var dat = {type:'captioninfo'}; 43 43 for(var i in obj) { dat[i] = obj[i]; } … … 47 47 48 48 /** Handler for captionate events. **/ 49 public function onCuePoint(obj:Object) {49 public function onCuePoint(obj:Object):void { 50 50 var dat = {type:'cuepoint'}; 51 51 for(var i in obj) { dat[i] = obj[i]; } … … 55 55 56 56 /** Some Limelight crap. **/ 57 public function onFCSubscribe(obj:Object) {57 public function onFCSubscribe(obj:Object):void { 58 58 var dat = {type:'fcsubscribe'}; 59 59 for(var i in obj) { dat[i] = obj[i]; } … … 63 63 64 64 /** Get image data from netstream. **/ 65 public function onImageData(obj:Object) {65 public function onImageData(obj:Object):void { 66 66 var dat = {type:'imagedata'}; 67 67 forward(obj); … … 70 70 71 71 /** Handler for LaasstSecond call. **/ 72 public function onLastSecond(obj:Object) {72 public function onLastSecond(obj:Object):void { 73 73 var dat = {type:'lastsecond'}; 74 74 forward(dat); … … 77 77 78 78 /** Get metadata information from netstream class. **/ 79 public function onMetaData(obj:Object) {79 public function onMetaData(obj:Object):void { 80 80 var dat = {type:'metadata'}; 81 81 for(var i in obj) { dat[i] = obj[i]; } … … 89 89 90 90 /** Receive NetStream playback codes. **/ 91 public function onPlayStatus(dat:Object) {91 public function onPlayStatus(dat:Object):void { 92 92 if(dat.code == "NetStream.Play.Complete") { 93 93 var dat = {type:'complete'}; … … 98 98 99 99 /** RTMP Sample callback. **/ 100 public function RtmpSampleAccess(obj:Object) {100 public function RtmpSampleAccess(obj:Object):void { 101 101 var dat = {type:'rtmpsampleaccess'}; 102 102 forward(dat); … … 105 105 106 106 /** Get textdata from netstream. **/ 107 public function onTextData(obj:Object) {107 public function onTextData(obj:Object):void { 108 108 var dat = {type:'textdata'}; 109 109 for(var i in obj) { dat[i] = obj[i]; } -
trunk/as3/com/jeroenwijering/utils/Playlister.as
r54 r57 23 23 24 24 /** Constructor. **/ 25 public function Playlister() {25 public function Playlister():void { 26 26 loader = new URLLoader(); 27 27 loader.addEventListener(Event.COMPLETE,loaderHandler); … … 33 33 34 34 /** Determine filetype and load file or list. **/ 35 public function load(obj:Object) {35 public function load(obj:Object):void { 36 36 if(typeof(obj) == 'string') { 37 37 var obj = {file:obj}; … … 65 65 66 66 /** Catch security and io errors **/ 67 private function errorHandler(evt:ErrorEvent) {67 private function errorHandler(evt:ErrorEvent):void { 68 68 dispatchEvent(new ErrorEvent(ErrorEvent.ERROR,false,false,status+': '+evt.text)); 69 69 }; … … 71 71 72 72 /** Translate the XML object to the feed array. **/ 73 private function loaderHandler(evt:Event) {73 private function loaderHandler(evt:Event):void { 74 74 try { 75 75 var dat = XML(evt.target.data); … … 106 106 107 107 /** Save the http status **/ 108 private function statusHandler(evt:HTTPStatusEvent) {108 private function statusHandler(evt:HTTPStatusEvent):void { 109 109 status = evt.status; 110 110 }; … … 118 118 119 119 /** Handler for manually updating elements. **/ 120 public function update(itm:Number,elm:String,val:Object) {120 public function update(itm:Number,elm:String,val:Object):void { 121 121 if(_playlist[itm]) { 122 122 _playlist[itm][elm] = val; -
trunk/as3/com/jeroenwijering/utils/Randomizer.as
r1 r57 21 21 * @param len Length of the list to randomize. 22 22 **/ 23 public function Randomizer(len:Number) {23 public function Randomizer(len:Number):void { 24 24 original = new Array(); 25 25 todo = new Array(); -
trunk/as3/com/jeroenwijering/utils/Stacker.as
r52 r57 28 28 * @param skn The MovieClip to manage stacking of. 29 29 **/ 30 public function Stacker(clp:MovieClip) {30 public function Stacker(clp:MovieClip):void { 31 31 clip = clp; 32 32 analyze(); … … 35 35 36 36 /** Analyze the MovieClip and save its children. **/ 37 private function analyze() {37 private function analyze():void { 38 38 _width = clip.width; 39 39 stack = new Array(); … … 53 53 if(i!=idx && stack[i].c.visible==true && stack[i].w < _width && 54 54 stack[i].x < max && stack[i].x+stack[i].w > min) { 55 // trace(stack[idx].n+'overlaps with'+stack[i].n);56 // trace(stack[i].x+'-'+max+' / '+(stack[i].x+stack[i].w)+'-'+min);55 //trace(stack[idx].n+' overlaps with '+stack[i].n); 56 //trace(stack[i].x+'-'+max+' / '+(stack[i].x+stack[i].w)+'-'+min); 57 57 return true; 58 58 } … … 67 67 * @param wid The target width of the clip. 68 68 **/ 69 public function rearrange(wid:Number=undefined) {69 public function rearrange(wid:Number=undefined):void { 70 70 if(wid) { latest = wid; } 71 71 var rdf = latest-width; … … 75 75 if(stack[i].x > width/2) { 76 76 stack[i].c.x = stack[i].x + rdf; 77 //trace(stack[i].n+': docked right'); 77 78 if(stack[i].c.visible == false && overlaps(i) == false) { 78 79 rdf -= stack[i+1].x - stack[i].x; … … 80 81 } else { 81 82 stack[i].c.x = stack[i].x-ldf; 83 //trace(stack[i].n+': docked left'); 82 84 if(stack[i].c.visible == false && overlaps(i) == false) { 83 85 if(stack[i-1].w > width/3) { … … 89 91 } 90 92 if(stack[i].w > width/3) { 93 //trace(stack[i].n+': stretched'); 91 94 stack[i].c.width = stack[i].w+rdf+ldf; 92 95 } … … 99 102 stack[j].c.x += dif; 100 103 } 101 if(stack[j].w >width/4 && stack[j].w<width) {104 if(stack[j].w > width/3 && stack[j].w < width) { 102 105 stack[j].c.width += dif; 103 106 } -
trunk/as3/com/jeroenwijering/utils/Stretcher.as
r1 r57 29 29 * @param typ The stretching type. 30 30 **/ 31 public static function stretch(clp:DisplayObject,wid:Number,hei:Number,typ:String='uniform') {31 public static function stretch(clp:DisplayObject,wid:Number,hei:Number,typ:String='uniform'):void { 32 32 var xsc = wid/clp.width; 33 33 var ysc = hei/clp.height; -
trunk/as3/com/jeroenwijering/utils/TEA.as
r52 r57 9 9 * See http://www.movable-type.co.uk/scripts/TEAblock.html 10 10 * 11 * Took the liberty of renaming this so all JW Player utils are in one package..11 * JW took the liberty of renaming this so all JW Player utils are in one package.. 12 12 */ 13 13 package com.jeroenwijering.utils {
Note: See TracChangeset
for help on using the changeset viewer.
