Changeset 6 for trunk/as3/com/jeroenwijering/player/Controller.as
- Timestamp:
- 06/09/08 05:34:58 (18 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/as3/com/jeroenwijering/player/Controller.as
r3 r6 5 5 6 6 7 import flash.display.MovieClip;8 import flash.events.*;9 import flash.net.*;10 7 import com.jeroenwijering.events.*; 11 8 import com.jeroenwijering.player.*; 12 9 import com.jeroenwijering.utils.*; 10 import flash.display.MovieClip; 11 import flash.events.*; 12 import flash.geom.Rectangle; 13 import flash.net.*; 14 import flash.system.Capabilities; 13 15 14 16 … … 28 30 /** object that povides randomization. **/ 29 31 private var randomizer:Randomizer; 30 /** save the state of the model. **/31 private var state:String;32 32 33 33 … … 39 39 skin.stage.align = "TL"; 40 40 skin.stage.addEventListener(Event.RESIZE,resizeHandler); 41 skin.stage.addEventListener(Event.FULLSCREEN,resizeHandler);42 41 playlister = new Playlister(); 43 42 playlister.addEventListener(Event.COMPLETE,playlistHandler); … … 49 48 public function start(mdl:Model,vie:View) { 50 49 model= mdl; 51 model.addEventListener(ModelEvent.STATE,stateHandler);52 50 model.addEventListener(ModelEvent.META,metaHandler); 53 51 model.addEventListener(ModelEvent.TIME,metaHandler); … … 94 92 skin.stage.displayState = 'normal'; 95 93 } else { 94 skin.stage["fullScreenSourceRect"] = new Rectangle(0,0, 95 Capabilities.screenResolutionX,Capabilities.screenResolutionY); 96 96 skin.stage.displayState = 'fullScreen'; 97 97 } … … 101 101 /** Jump to a userdefined item in the playlist. **/ 102 102 private function itemHandler(evt:ViewEvent) { 103 if(playlist[config['item']]['author'] == 'commercial') { return; } 103 104 var itm = evt.data.index; 104 105 if (itm < 0) { … … 163 164 /** Jump to the next item in the playlist. **/ 164 165 private function nextHandler(evt:ViewEvent) { 166 if(playlist[config['item']]['author'] == 'commercial') { return; } 165 167 if(config['shuffle'] == true) { 166 168 playItem(randomizer.pick()); … … 177 179 if(evt.data.state) { 178 180 dispatchEvent(new ControllerEvent(ControllerEvent.PLAY,{state:evt.data.state})); 179 } else if( state == ModelStates.PLAYING || state== ModelStates.BUFFERING) {181 } else if(config['state'] == ModelStates.PLAYING || config['state'] == ModelStates.BUFFERING) { 180 182 dispatchEvent(new ControllerEvent(ControllerEvent.PLAY,{state:false})); 181 183 } else { … … 211 213 /** Jump to the previous item in the playlist. **/ 212 214 private function prevHandler(evt:ViewEvent) { 215 if(playlist[config['item']]['author'] == 'commercial') { return; } 213 216 if(config['shuffle'] == true) { 214 217 playItem(randomizer.back()); … … 261 264 /** Seek to a specific part in a mediafile. **/ 262 265 private function seekHandler(evt:ViewEvent) { 266 if(playlist[config['item']]['author'] == 'commercial') { return; } 263 267 var pos = evt.data.position; 264 268 if(pos < 2) { pos = 0; } … … 277 281 /** Manage playback state changes **/ 278 282 private function stateHandler(evt:ModelEvent) { 279 state = evt.data.newstate;280 283 if(evt.data.newstate == ModelStates.COMPLETED && (config['repeat'] == true || 281 284 (config['shuffle'] == true && randomizer.length > 0) ||
