Changeset 76


Ignore:
Timestamp:
10/02/08 11:12:01 (5 years ago)
Author:
jeroen
Message:

added a scaling flashvar to prevent stage scaling and an PlayerReady.READY event for loading in FLEX

Location:
branches/4.2
Files:
2 added
4 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2/com/jeroenwijering/player/Controller.as

    r75 r76  
    240240        /** Forward a resizing of the stage. **/ 
    241241        private function redrawHandler(evt:ViewEvent=null):void { 
    242                 var dat = { 
    243                         width:skin.stage.stageWidth, 
    244                         height:skin.stage.stageHeight, 
    245                         fullscreen:false 
    246                 }; 
     242                var dat = new Object(); 
    247243                try {  
    248244                        var dps = skin.stage['displayState']; 
     
    250246                if(dps == 'fullScreen') { 
    251247                        dat.fullscreen = true; 
    252                 } else { 
     248                        dat.width = skin.stage.stageWidth; 
     249                        dat.height = skin.stage.stageHeight; 
     250                } else if(config['scaling']) { 
     251                        dat.fullscreen = false; 
     252                        dat.width = skin.stage.stageWidth; 
     253                        dat.height = skin.stage.stageHeight; 
    253254                        if(config['controlbar'] == 'bottom') { 
    254255                                dat.height -= config['controlbarsize']; 
     
    259260                                dat.height -= config['playlistsize']; 
    260261                        } 
    261                 } 
    262                 config['height'] = dat.height; 
    263                 config['width'] = dat.width; 
     262                        config['height'] = dat.height; 
     263                        config['width'] = dat.width; 
     264                } else {  
     265                        dat.fullscreen = false; 
     266                        dat.width = config['width']; 
     267                        dat.height = config['height']; 
     268                } 
    264269                dispatchEvent(new ControllerEvent(ControllerEvent.RESIZE,dat)); 
    265270        }; 
  • branches/4.2/com/jeroenwijering/player/Desktop.as

    r75 r76  
    88import com.jeroenwijering.plugins.*; 
    99import flash.display.MovieClip; 
    10 import flash.events.Event; 
    1110 
    1211 
     
    1918 
    2019        /** When added to stage, the player loads the config. **/ 
    21         override protected function loadConfig(evt:Event):void { 
     20        override protected function loadConfig():void { 
    2221                config['frontcolor'] = 'CCCCCC'; 
    2322                config['lightcolor'] = '99CC00'; 
    2423                config['autostart'] = true; 
    25                 loadMVC(); 
     24                loadSkin(); 
    2625        }; 
    2726 
  • branches/4.2/com/jeroenwijering/player/Player.as

    r75 r76  
    55 
    66 
     7import com.jeroenwijering.events.*; 
    78import com.jeroenwijering.player.*; 
    89import com.jeroenwijering.plugins.*; 
     
    2122                date:undefined, 
    2223                duration:0, 
    23                 file:'http://www.jeroenwijering.com/upload/bunny.mp3', 
     24                file:undefined, 
    2425                image:undefined, 
    2526                link:undefined, 
     
    2930                type:undefined, 
    3031 
    31                 backcolor:'000000', 
    32                 frontcolor:'ffffff', 
     32                backcolor:undefined, 
     33                frontcolor:undefined, 
    3334                lightcolor:undefined, 
    3435                screencolor:undefined, 
     
    3738                controlbarsize:20, 
    3839                height:300, 
    39                 icons:true, 
    40                 logo:undefined, 
    41                 playlist:'right', 
     40                playlist:'none', 
    4241                playlistsize:180, 
    4342                skin:undefined, 
     
    4746                bufferlength:1, 
    4847                displayclick:'play', 
     48                icons:true, 
    4949                item:0, 
     50                logo:undefined, 
    5051                mute:false, 
    5152                quality:true, 
    5253                repeat:'none', 
    5354                shuffle:false, 
     55                scaling:true, 
    5456                state:'IDLE', 
    5557                stretching:'uniform', 
     
    6163                id:undefined, 
    6264                linktarget:'_blank', 
    63                 plugins:'resizer.swf,yousearch.swf', 
     65                plugins:undefined, 
    6466                streamer:undefined, 
    6567                token:undefined, 
    66                 tracer:'arthropod', 
     68                tracecall:undefined, 
    6769                version:'4.2.71' 
    6870        }; 
     
    8789                visible = false; 
    8890                skin = this['player']; 
    89                 addEventListener(Event.ADDED_TO_STAGE,loadConfig); 
     91                loadConfig(); 
    9092        }; 
    9193 
    9294 
    9395        /** When added to stage, the player loads the config. **/ 
    94         protected function loadConfig(evt:Event):void {  
     96        protected function loadConfig():void {  
    9597                configger = new Configger(this); 
    9698                configger.addEventListener(Event.COMPLETE,loadSkin); 
     
    102104        protected function loadSkin(evt:Event=null):void { 
    103105                loader = new SWFLoader(this); 
    104                 loader.addEventListener(Event.INIT,loadMVC); 
     106                loader.addEventListener(SWFLoaderEvent.SKIN,loadMVC); 
    105107                loader.loadSkin(config['skin']); 
    106108        }; 
     
    108110 
    109111        /** Skin loading completed, now load MVC. **/ 
    110         protected function loadMVC(evt:Event=null):void { 
     112        protected function loadMVC(evt:SWFLoaderEvent=null):void { 
    111113                controller = new Controller(config,skin); 
    112114                model = new Model(config,skin,controller); 
     
    121123                new Display().initializePlugin(view); 
    122124                new Controlbar().initializePlugin(view); 
    123                 if(skin['playlist']) { new Playlist().initializePlugin(view); } 
    124                 loader.addEventListener(Event.COMPLETE,startPlayer); 
     125                new Playlist().initializePlugin(view); 
     126                loader.addEventListener(SWFLoaderEvent.PLUGINS,startPlayer); 
    125127                loader.loadPlugins(config['plugins']); 
    126128        }; 
     
    128130 
    129131        /** Everything loaded; start player. **/ 
    130         protected function startPlayer(evt:Event=null) { 
    131                 loader.removeEventListener(Event.COMPLETE,startPlayer); 
     132        protected function startPlayer(evt:SWFLoaderEvent=null) { 
     133                loader.removeEventListener(SWFLoaderEvent.PLUGINS,startPlayer); 
    132134                controller.start(model,view); 
    133135                visible = true; 
     136                dispatchEvent(new PlayerEvent(PlayerEvent.READY)); 
    134137        }; 
    135138 
  • branches/4.2/com/jeroenwijering/player/SWFLoader.as

    r75 r76  
    77 
    88 
     9import com.jeroenwijering.events.SWFLoaderEvent; 
    910import com.jeroenwijering.utils.Draw; 
    1011import flash.display.Loader; 
    1112import flash.display.MovieClip; 
    12 import flash.events.*; 
     13import flash.events.Event; 
     14import flash.events.EventDispatcher; 
     15import flash.events.IOErrorEvent; 
    1316import flash.net.URLRequest; 
    1417import flash.system.*; 
     
    5154                        } 
    5255                } else { 
    53                         dispatchEvent(new Event(Event.COMPLETE)); 
     56                        dispatchEvent(new SWFLoaderEvent(SWFLoaderEvent.PLUGINS)); 
    5457                } 
    5558        }; 
     
    6568                        loadSWF(skn,true); 
    6669                } else { 
    67                         dispatchEvent(new Event(Event.INIT)); 
     70                        dispatchEvent(new SWFLoaderEvent(SWFLoaderEvent.SKIN)); 
    6871                } 
    6972        }; 
     
    104107                done--; 
    105108                if(done == 0) { 
    106                         dispatchEvent(new Event(Event.COMPLETE)); 
     109                        dispatchEvent(new SWFLoaderEvent(SWFLoaderEvent.PLUGINS)); 
    107110                } 
    108111        }; 
     
    119122                done--; 
    120123                if(done == 0) { 
    121                         dispatchEvent(new Event(Event.COMPLETE)); 
     124                        dispatchEvent(new SWFLoaderEvent(SWFLoaderEvent.PLUGINS)); 
    122125                } 
    123126        }; 
     
    127130        private function skinError(evt:IOErrorEvent=null):void { 
    128131                player.skin = player['player']; 
    129                 dispatchEvent(new Event(Event.INIT)); 
     132                dispatchEvent(new SWFLoaderEvent(SWFLoaderEvent.SKIN)); 
    130133        }; 
    131134 
     
    138141                        Draw.clear(player); 
    139142                        player.addChild(player.skin); 
    140                         dispatchEvent(new Event(Event.INIT)); 
     143                        dispatchEvent(new SWFLoaderEvent(SWFLoaderEvent.SKIN)); 
    141144                } else { 
    142145                        skinError(); 
  • branches/4.2/com/jeroenwijering/player/View.as

    r75 r76  
    4444                _config['client'] = 'FLASH '+Capabilities.version; 
    4545                _skin = skn; 
    46                 _skin.stage.scaleMode = "noScale"; 
    47                 _skin.stage.align = "TL"; 
    48                 _skin.stage.addEventListener(Event.RESIZE,resizeHandler); 
     46                if(_config['scaling']) { 
     47                        _skin.stage.scaleMode = "noScale"; 
     48                        _skin.stage.align = "TL"; 
     49                        _skin.stage.addEventListener(Event.RESIZE,resizeHandler); 
     50                } 
    4951                loader = ldr; 
    5052                controller = ctr; 
  • branches/4.2/com/jeroenwijering/utils/Configger.as

    r66 r76  
    2020        private var reference:Sprite; 
    2121        /** Reference to the config object. **/ 
    22         public var config:Object; 
     22        private var config:Object; 
    2323        /** XML loading object reference **/ 
    2424        private var loader:URLLoader; 
Note: See TracChangeset for help on using the changeset viewer.