source: branches/4.2/com/jeroenwijering/player/Player.as @ 68

Revision 68, 3.1 KB checked in by jeroen, 5 years ago (diff)

added new feeditems, polished simple/thin skins and made sure large YT images are loaded by default

  • Property svn:executable set to *
  • Property svn:keywords set to Rev
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.plugins.*;
9import com.jeroenwijering.utils.Configger;
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. Change them to hard-code your preferences. **/
18        public var config:Object = {
19                author:undefined,
20                description:undefined,
21                date:undefined,
22                duration:0,
23                file:undefined,
24                image:undefined,
25                link:undefined,
26                start:0,
27                tags:undefined,
28                title:undefined,
29                type:undefined,
30
31                backcolor:undefined,
32                frontcolor:undefined,
33                lightcolor:undefined,
34                screencolor:undefined,
35
36                controlbar:'bottom',
37                controlbarsize:20,
38                height:300,
39                icons:true,
40                logo:undefined,
41                playlist:'none',
42                playlistsize:180,
43                skin:undefined,
44                width:400,
45
46                autostart:false,
47                bufferlength:1,
48                displayclick:'play',
49                item:0,
50                mute:false,
51                quality:true,
52                repeat:'none',
53                shuffle:false,
54                state:'IDLE',
55                stretching:'uniform',
56                volume:80,
57
58                abouttext:undefined,
59                aboutlink:"http://www.jeroenwijering.com/?item=JW_FLV_Player",
60                client:undefined,
61                id:undefined,
62                linktarget:'_blank',
63                margins:'0,0',
64                plugins:undefined,
65                streamer:undefined,
66                token:undefined,
67                tracer:undefined,
68                version:'4.2.67'
69        };
70        /** Reference to all stage graphics. **/
71        public var skin:MovieClip;
72        /** Object that loads all configuration variables. **/
73        private var configger:Configger;
74        /** Object that load the skin and plugins. **/
75        private var loader:SWFLoader;
76        /** Reference to the Controller of the MVC cycle. **/
77        private var controller:Controller;
78        /** Reference to the model of the MVC cycle. **/
79        private var model:Model;
80        /** Reference to the View of the MVC cycle, which defines all API calls. **/
81        public var view:View;
82
83
84        /**
85        * Constructor; initializes and starts the player.
86        **/
87        public function Player():void {
88                visible = false;
89                skin = this.player;
90                addEventListener(Event.ADDED_TO_STAGE,loadConfig);
91        };
92
93
94        /** When added to stage, the player loads the config. **/
95        private function loadConfig(evt:Event):void {
96                configger = new Configger(this);
97                configger.addEventListener(Event.COMPLETE,loadSkin);
98                configger.load(config);
99        };
100
101
102        /** Config loading completed; now load skin. **/
103        private function loadSkin(evt:Event):void {
104                loader = new SWFLoader(this);
105                loader.addEventListener(Event.COMPLETE,loadMVC);
106                loader.loadSkin(config['skin']);
107        };
108
109
110        /** Skin loading completed, now load MVC. **/
111        private function loadMVC(evt:Event):void {
112                controller = new Controller(config,skin);
113                model = new Model(config,skin,controller);
114                view = new View(config,skin,controller,model,loader);
115                controller.start(model,view);
116                loadPlugins();
117        };
118
119
120        /** MVC inited; now load plugins. **/
121        private function loadPlugins() {
122                new Rightclick().initializePlugin(view);
123                new Display().initializePlugin(view);
124                new Controlbar().initializePlugin(view);
125                if(skin['playlist']) { new Playlist().initializePlugin(view); }
126                loader.loadPlugins(config['plugins']);
127                visible = true;
128        };
129
130
131}
132
133
134}
Note: See TracBrowser for help on using the repository browser.