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

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

added js initer BUT destroyed controlbar display

  • 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/mrss.xml',
24                image:undefined,
25                link:undefined,
26                start:0,
27                title:undefined,
28                type:undefined,
29
30                controlbar:'bottom',
31                logo:undefined,
32                playlist:'none',
33                playlistsize:180,
34                skin:undefined,
35
36                autostart:false,
37                bufferlength:1,
38                caption:true,
39                displayclick:'play',
40                fullscreen:false,
41                item:0,
42                mute:false,
43                quality:true,
44                repeat:false,
45                shuffle:false,
46                stretching:'uniform',
47                volume:80,
48
49                abouttext:"About JW Player 4.0...",
50                aboutlink:"http://www.jeroenwijering.com/?page=about",
51                linktarget:'_self',
52                streamscript:'lighttpd',
53                tracecall:undefined,
54
55                client:undefined,
56                controlbarheight:20,
57                height:300,
58                version:'4.0 r3',
59                width:400
60        };
61        /** Object that loads all configuration variables. **/
62        private var configger:Configger;
63        /** Object that load the skin and inits the layout. **/
64        private var skinner:Skinner;
65        /** Reference to the Controller of the MVC cycle. **/
66        private var controller:Controller;
67        /** Reference to the model of the MVC cycle. **/
68        private var model:Model;
69        /** Reference to the View of the MVC cycle. **/
70        private var _view:View;
71
72
73        /** Constructor; Loads config. **/
74        public function Player() {
75                configger = new Configger(this);
76                configger.addEventListener(Event.COMPLETE,configHandler);
77                configger.load(defaults);
78        };
79
80
81        /** Config loading completed; now load skin. **/
82        private function configHandler(evt:Event) {
83                skinner = new Skinner(this);
84                skinner.addEventListener(Event.COMPLETE,skinHandler);
85                skinner.load(configger.config['skin']);
86        };
87
88
89        /** Skin loading completed, now load MVC and plugins. **/
90        private function skinHandler(evt:Event) {
91                controller = new Controller(configger.config,skinner.skin);
92                model = new Model(configger.config,skinner.skin,controller);
93                _view = new View(configger.config,skinner.skin,controller,model);
94                controller.start(model,_view);
95        };
96
97
98        /** reference to the view, so plugins and listeners can interface. **/
99        public function get view():View {
100                return _view;
101        };
102
103
104}
105
106
107}
Note: See TracBrowser for help on using the browser.