Changeset 57 for trunk/as3/com/jeroenwijering/models/HTTPModel.as
- Timestamp:
- 08/12/08 05:04:55 (5 years ago)
- File:
-
- 1 edited
-
trunk/as3/com/jeroenwijering/models/HTTPModel.as (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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;
Note: See TracChangeset
for help on using the changeset viewer.
