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

Revision 2, 2.6 kB (checked in by jeroen, 18 months ago)

fixes in skinning and controlbar

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