root/trunk/as3/com/jeroenwijering/player/Player.as @ 4

Revision 4, 2.5 kB (checked in by jeroen, 18 months ago)

implemented stacker; display of media and some controlbaritems still broken

  • Property svn:executable set to *
Line 
1/**
2* Player that crunches through all media formats Flash can read.
3**/
4package com.jeroenwijering.player {
5
6
7import com.jeroenwijering.player.*;
8import com.jeroenwijering.utils.Configger;
9import com.jeroenwijering.utils.Skinner;
10import flash.display.MovieClip;
11import flash.events.Event;
12
13
14public class Player extends MovieClip {
15
16
17        /** A list with all default configuration values. **/
18        private var defaults:Object = {
19                author:undefined,
20                captions:undefined,
21                description:undefined,
22                duration:0,
23                file:'http://www.jeroenwijering.com/upload/xspf.xml',
24                image:undefined,
25                link:undefined,
26                start:0,
27                title:undefined,
28                type:undefined,
29
30                controlbar:'over',
31                logo:undefined,
32                playlist:'bottom',
33                playlistsize:180,
34                skin:undefined,
35
36                autostart:false,
37                bufferlength:1,
38                caption:true,
39                digits:true,
40                displayclick:'play',
41                fullscreen:false,
42                item:0,
43                mute:false,
44                quality:true,
45                repeat:false,
46                shuffle:false,
47                stretching:'uniform',
48                volume:80,
49
50                abouttext:"About JW Player 4.0...",
51                aboutlink:"http://www.jeroenwijering.com/?page=about",
52                linktarget:'_self',
53                streamscript:undefined,
54                tracecall:undefined,
55
56                client:undefined,
57                controlbarheight:20,
58                height:300,
59                version:'4.0 r3',
60                width:400
61        };
62        /** Object that loads all configuration variables. **/
63        private var configger:Configger;
64        /** Object that load the skin and inits the layout. **/
65        private var skinner:Skinner;
66        /** Reference to the Controller of the MVC cycle. **/
67        private var controller:Controller;
68        /** Reference to the model of the MVC cycle. **/
69        private var model:Model;
70        /** Reference to the View of the MVC cycle. **/
71        private var _view:View;
72
73
74        /** Constructor; Loads config. **/
75        public function Player() {
76                configger = new Configger(this);
77                configger.addEventListener(Event.COMPLETE,configHandler);
78                configger.load(defaults);
79        };
80
81
82        /** Config loading completed; now load skin. **/
83        private function configHandler(evt:Event) {
84                skinner = new Skinner(this);
85                skinner.addEventListener(Event.COMPLETE,skinHandler);
86                skinner.load(configger.config['skin']);
87        };
88
89
90        /** Skin loading completed, now load MVC and plugins. **/
91        private function skinHandler(evt:Event) {
92                controller = new Controller(configger.config,skinner.skin);
93                model = new Model(configger.config,skinner.skin,controller);
94                _view = new View(configger.config,skinner.skin,controller,model);
95                controller.start(model,_view);
96        };
97
98
99        /** reference to the view, so plugins and listeners can interface. **/
100        public function get view():View {
101                return _view;
102        };
103
104
105}
106
107
108}
Note: See TracBrowser for help on using the browser.