Changeset 75


Ignore:
Timestamp:
10/01/08 09:07:36 (5 years ago)
Author:
jeroen
Message:

air version is working, string of fixes to 4.2

Files:
23 added
3 deleted
16 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2/com/carlcalderon/arthropod/Debug.as

    r63 r75  
    11/** 
    22* Debug 
    3 * Designed for version 0.81 to 0.96.7 of the Arthropod Debugger. 
     3* Designed for version 0.96.7 to 1.0 of the Arthropod Debugger. 
    44*  
    55* USE AT YOUR OWN RISK! 
     
    1616*  
    1717* @author Carl Calderon 2008 
    18 * @version 0.73 
     18* @version 0.74 
    1919* @link http.//www.carlcalderon.com/ 
    20 * @since 0.61 
     20* @since 0.72 
    2121*/ 
    2222 
     
    2525        import flash.display.Bitmap; 
    2626        import flash.display.BitmapData; 
     27        import flash.display.DisplayObject; 
     28        import flash.display.IBitmapDrawable; 
     29        import flash.display.Stage; 
    2730        import flash.events.StatusEvent; 
    2831        import flash.geom.Matrix; 
     
    3841                 */ 
    3942                public static const NAME                :String = 'Debug'; 
    40                 public static const VERSION             :String = '0.72'; 
     43                public static const VERSION             :String = '0.74'; 
     44                 
     45                /** 
     46                 * Privacy 
     47                 * By setting this password, you need to enter the 
     48                 * same in "Arthropod -> Settings -> Connection Password" 
     49                 * to be able to see the traces. 
     50                 *  
     51                 * default: 'CDC309AF'; 
     52                 */ 
     53                public static var password              :String = 'CDC309AF'; 
    4154                 
    4255                /** 
     
    8093                private static const TYPE                       :String = 'app'; 
    8194                private static const CONNECTION         :String = 'arthropod'; 
    82                 private static const SECURITY           :String = 'CDC309AF'; 
    8395                 
    8496                private static const LOG_OPERATION              :String = 'debug'; 
     
    101113                 * @return                              True if successful 
    102114                 */ 
    103                 public static function log(message:String,color:uint=0xFEFEFE) :Boolean { 
    104                         return send ( LOG_OPERATION, message, color ); 
     115                public static function log ( message:*, color:uint = 0xFEFEFE ) :Boolean { 
     116                        return send ( LOG_OPERATION, String ( message ) , color ) ; 
    105117                } 
    106118                 
     
    112124                 * @return                              True if successful 
    113125                 */ 
    114                 public static function error(message:String) :Boolean { 
    115                         return send ( ERROR_OPERATION, message, 0xCC0000 ); 
     126                public static function error ( message:* ) :Boolean { 
     127                        return send ( ERROR_OPERATION, String ( message ) , 0xCC0000 ) ; 
    116128                } 
    117129                 
     
    123135                 * @return                              True if successful 
    124136                 */ 
    125                 public static function warning(message:String) :Boolean { 
    126                         return send ( WARNING_OPERATION, message, 0xCCCC00 ); 
     137                public static function warning ( message:* ) :Boolean { 
     138                        return send ( WARNING_OPERATION, String ( message ) , 0xCCCC00 ) ; 
    127139                } 
    128140                 
     
    162174                 * BitmapData to an acceptable size for the call. 
    163175                 *  
    164                  * @param       bmd                     BitmapData to be traced as 
    165                  *                                              a thumbnail 
    166                  * @return                              True if successful 
    167                  */ 
    168                 public static function bitmap ( bmd:BitmapData ) :Boolean { 
     176                 * @param       bmd                     Any IBitmapDrawable 
     177                 * @param       label           Label 
     178                 * @return                              True if successful 
     179                 */ 
     180                public static function bitmap ( bmd:*, label:String = null ) :Boolean { 
    169181                        var bm:BitmapData = new BitmapData ( 100, 100, true, 0x00FFFFFF ) ; 
    170182                        var mtx:Matrix = new Matrix ( ) ; 
     
    172184                        mtx.scale ( s, s ) ; 
    173185                        bm.draw ( bmd, mtx,null,null,null,true ) ; 
    174                         var bounds:Rectangle = new Rectangle ( 0, 0, Math.floor(bmd.width*s), Math.floor(bmd.height*s) ) ; 
    175                         var ba:ByteArray = bm.getPixels ( bounds ) ; 
    176                         return send ( BITMAP_OPERATION, ba, bounds ) ; 
     186                        var bounds:Rectangle = new Rectangle ( 0, 0, Math.floor ( bmd.width * s ) , Math.floor ( bmd.height * s ) ) ; 
     187                        return send ( BITMAP_OPERATION, bm.getPixels ( bounds ), { bounds:bounds, lbl:label } ) ; 
     188                } 
     189                 
     190                /** 
     191                 * Traces a snapshot of the current stage state. 
     192                 *  
     193                 * @param       stage           Stage 
     194                 * @param       label           Label 
     195                 * @return                              True if successful 
     196                 */ 
     197                public static function snapshot ( stage:Stage, label:String=null ) :Boolean { 
     198                        if ( stage ) 
     199                                return bitmap ( stage, label ) ; 
     200                        return false; 
    177201                } 
    178202                 
     
    192216                 * @return                              True if successful 
    193217                 */ 
    194                 public static function object ( obj:*) :Boolean { 
     218                public static function object ( obj:* ) :Boolean { 
    195219                        return send ( OBJECT_OPERATION, obj, null ) ; 
    196220                } 
     
    215239                 * @param       color           opt. Color of the message 
    216240                 */ 
    217                 private static function send( operation:String,value:*, prop:* ) { 
     241                private static function send( operation:String, value:*, prop:* ):Boolean { 
    218242                        if (!secure)    lc.allowInsecureDomain('*'); 
    219243                        else                    lc.allowDomain(secureDomain); 
     
    225249                        if(allowLog){ 
    226250                                try { 
    227                                         lc.send ( TYPE + '#' + DOMAIN + CHECK + ':' + CONNECTION , operation, SECURITY, value, prop ) ; 
     251                                        lc.send ( TYPE + '#' + DOMAIN + CHECK + ':' + CONNECTION , operation, password, value, prop ) ; 
    228252                                        return true; 
    229                                 } catch (e) { 
     253                                } catch (e:*) { 
    230254                                        return false; 
    231255                                } 
    232256                        } 
     257                        return false; 
    233258                } 
    234259                 
  • branches/4.2/com/jeroenwijering/models/SoundModel.as

    r64 r75  
    6161 
    6262 
     63        /** Forward ID3 data from the sound. **/ 
     64        private function id3Handler(evt:Event):void { 
     65                try { 
     66                        var id3:ID3Info = sound.id3; 
     67                        var obj = { 
     68                                album:id3.album, 
     69                                artist:id3.artist, 
     70                                comment:id3.comment, 
     71                                genre:id3.genre, 
     72                                songName:id3.songName, 
     73                                track:id3.track, 
     74                                year:id3.year 
     75                        } 
     76                        model.sendEvent(ModelEvent.META,obj); 
     77                } catch (err:Error) {} 
     78        }; 
     79 
     80 
    6381        /** Load the sound. **/ 
    6482        public function load():void { 
     
    6886                sound.addEventListener(IOErrorEvent.IO_ERROR,errorHandler); 
    6987                sound.addEventListener(ProgressEvent.PROGRESS,progressHandler); 
     88                sound.addEventListener(Event.ID3,id3Handler); 
    7089                sound.load(new URLRequest(model.playlist[model.config['item']]['file']),context); 
    7190                model.mediaHandler(); 
  • branches/4.2/com/jeroenwijering/parsers/ATOMParser.as

    r68 r75  
    4747                                        if(i.@rel == 'alternate') { 
    4848                                                itm['link'] = i.@href.toString(); 
    49                                         } else {  
    50                                                 itm[i.@rel.toString()] = i.@href.toString(); 
     49                                        } else { 
     50                                                var pt1:RegExp = /^(.+)#(.+)$/g; 
     51                                                var pt2:RegExp = /^(.+)\.(.+)$/g; 
     52                                                var nam:String = i.@rel.toString().replace(pt1,"$2").replace(pt2,'$2'); 
     53                                                itm[nam] = i.@href.toString(); 
    5154                                        } 
    5255                                        break; 
  • branches/4.2/com/jeroenwijering/parsers/ObjectParser.as

    r68 r75  
    129129                if(!itm['duration']) { itm['duration'] = 0; } 
    130130                if(!itm['start']) { itm['start'] = 0; } 
     131                //for(var i in itm) { trace(i+': '+itm[i]); } 
    131132                return itm; 
    132133        }; 
  • branches/4.2/com/jeroenwijering/player/Controller.as

    r66 r75  
    240240        /** Forward a resizing of the stage. **/ 
    241241        private function redrawHandler(evt:ViewEvent=null):void { 
    242                 var mgn = config['margins'].split(','); 
    243242                var dat = { 
    244                         width:skin.stage.stageWidth-mgn[0], 
    245                         height:skin.stage.stageHeight-mgn[1], 
     243                        width:skin.stage.stageWidth, 
     244                        height:skin.stage.stageHeight, 
    246245                        fullscreen:false 
    247246                }; 
  • branches/4.2/com/jeroenwijering/player/Player.as

    r73 r75  
    1515 
    1616 
    17         /** A list with all default configuration values. Change them to hard-code your preferences. **/ 
     17        /** All configuration values. Change them to hard-code your preferences. **/ 
    1818        public var config:Object = { 
    1919                author:undefined, 
     
    2121                date:undefined, 
    2222                duration:0, 
    23                 file:undefined, 
     23                file:'http://www.jeroenwijering.com/upload/bunny.mp3', 
    2424                image:undefined, 
    2525                link:undefined, 
     
    2929                type:undefined, 
    3030 
    31                 backcolor:undefined, 
    32                 frontcolor:undefined, 
     31                backcolor:'000000', 
     32                frontcolor:'ffffff', 
    3333                lightcolor:undefined, 
    3434                screencolor:undefined, 
     
    3939                icons:true, 
    4040                logo:undefined, 
    41                 playlist:'none', 
     41                playlist:'right', 
    4242                playlistsize:180, 
    4343                skin:undefined, 
     
    6161                id:undefined, 
    6262                linktarget:'_blank', 
    63                 margins:'0,0', 
    64                 plugins:undefined, 
     63                plugins:'resizer.swf,yousearch.swf', 
    6564                streamer:undefined, 
    6665                token:undefined, 
    67                 tracer:undefined, 
     66                tracer:'arthropod', 
    6867                version:'4.2.71' 
    6968        }; 
     
    7170        public var skin:MovieClip; 
    7271        /** Object that loads all configuration variables. **/ 
    73         private var configger:Configger; 
     72        protected var configger:Configger; 
    7473        /** Object that load the skin and plugins. **/ 
    75         private var loader:SWFLoader; 
     74        protected var loader:SWFLoader; 
    7675        /** Reference to the Controller of the MVC cycle. **/ 
    77         private var controller:Controller; 
     76        protected var controller:Controller; 
    7877        /** Reference to the model of the MVC cycle. **/ 
    79         private var model:Model; 
     78        protected var model:Model; 
    8079        /** Reference to the View of the MVC cycle, which defines all API calls. **/ 
    8180        public var view:View; 
     
    8786        public function Player():void { 
    8887                visible = false; 
    89                 skin = this.player; 
     88                skin = this['player']; 
    9089                addEventListener(Event.ADDED_TO_STAGE,loadConfig); 
    9190        }; 
     
    9392 
    9493        /** When added to stage, the player loads the config. **/ 
    95         private function loadConfig(evt:Event):void {  
     94        protected function loadConfig(evt:Event):void {  
    9695                configger = new Configger(this); 
    9796                configger.addEventListener(Event.COMPLETE,loadSkin); 
     
    101100 
    102101        /** Config loading completed; now load skin. **/ 
    103         private function loadSkin(evt:Event):void { 
     102        protected function loadSkin(evt:Event=null):void { 
    104103                loader = new SWFLoader(this); 
    105                 loader.addEventListener(Event.COMPLETE,loadMVC); 
     104                loader.addEventListener(Event.INIT,loadMVC); 
    106105                loader.loadSkin(config['skin']); 
    107106        }; 
     
    109108 
    110109        /** Skin loading completed, now load MVC. **/ 
    111         private function loadMVC(evt:Event):void { 
     110        protected function loadMVC(evt:Event=null):void { 
    112111                controller = new Controller(config,skin); 
    113112                model = new Model(config,skin,controller); 
    114113                view = new View(config,skin,controller,model,loader); 
    115                 controller.start(model,view); 
    116114                loadPlugins(); 
    117115        }; 
     
    119117 
    120118        /** MVC inited; now load plugins. **/ 
    121         private function loadPlugins() { 
     119        protected function loadPlugins():void { 
    122120                new Rightclick().initializePlugin(view); 
    123121                new Display().initializePlugin(view); 
    124122                new Controlbar().initializePlugin(view); 
    125123                if(skin['playlist']) { new Playlist().initializePlugin(view); } 
     124                loader.addEventListener(Event.COMPLETE,startPlayer); 
    126125                loader.loadPlugins(config['plugins']); 
     126        }; 
     127 
     128 
     129        /** Everything loaded; start player. **/ 
     130        protected function startPlayer(evt:Event=null) { 
     131                loader.removeEventListener(Event.COMPLETE,startPlayer); 
     132                controller.start(model,view); 
    127133                visible = true; 
    128134        }; 
    129  
    130135 
    131136} 
  • branches/4.2/com/jeroenwijering/player/SWFLoader.as

    r68 r75  
    2424        /** Base directory for the plugins. **/ 
    2525        private var basedir:String = 'http://plugins.longtailvideo.com/'; 
     26        /** Number of plugns that are done loading. **/ 
     27        private var done:Number; 
    2628 
    2729 
     
    4345        public function loadPlugins(pgi:String=null):void { 
    4446                if(pgi) { 
    45                         var arr = pgi.split(','); 
    46                         for(var i in arr) { loadSWF(arr[i],false); } 
     47                        var arr:Array = pgi.split(','); 
     48                        done = arr.length; 
     49                        for(var i:Number=0; i<arr.length; i++) { 
     50                                loadSWF(arr[i],false); 
     51                        } 
     52                } else { 
     53                        dispatchEvent(new Event(Event.COMPLETE)); 
    4754                } 
    48         };  
     55        }; 
    4956 
    5057 
     
    5865                        loadSWF(skn,true); 
    5966                } else { 
    60                         dispatchEvent(new Event(Event.COMPLETE)); 
     67                        dispatchEvent(new Event(Event.INIT)); 
    6168                } 
    6269        }; 
     
    95102        private function pluginError(evt:IOErrorEvent):void { 
    96103                player.view.sendEvent('TRACE',' plugin: '+evt.text); 
     104                done--; 
     105                if(done == 0) { 
     106                        dispatchEvent(new Event(Event.COMPLETE)); 
     107                } 
    97108        }; 
    98109 
     
    106117                        player.view.sendEvent('TRACE',' plugin: '+err.message); 
    107118                } 
     119                done--; 
     120                if(done == 0) { 
     121                        dispatchEvent(new Event(Event.COMPLETE)); 
     122                } 
    108123        }; 
    109124 
     
    112127        private function skinError(evt:IOErrorEvent=null):void { 
    113128                player.skin = player['player']; 
    114                 dispatchEvent(new Event(Event.COMPLETE)); 
     129                dispatchEvent(new Event(Event.INIT)); 
    115130        }; 
    116131 
     
    120135                var clp = evt.target.content; 
    121136                if(clp['player']) { 
    122                         player.skin = MovieClip(clp['player']); 
     137                        player.skin = clp['player'] as MovieClip; 
    123138                        Draw.clear(player); 
    124139                        player.addChild(player.skin); 
    125                         dispatchEvent(new Event(Event.COMPLETE)); 
     140                        dispatchEvent(new Event(Event.INIT)); 
    126141                } else { 
    127142                        skinError(); 
  • branches/4.2/com/jeroenwijering/player/View.as

    r72 r75  
    5050                controller = ctr; 
    5151                model = mdl; 
     52                setListening(); 
    5253                if(ExternalInterface.available && _skin.loaderInfo.url.indexOf('http') == 0) { 
    5354                        listeners = new Array(); 
    5455                        setJavascript(); 
    55                         setListening(); 
    56                 } else if (Capabilities.playerType == 'External') { 
    57                         setListening(); 
    5856                } 
    5957        }; 
     
    102100                        var obj = {CONTROLLER:'0xFF6666',VIEW:'0x66FF66',MODEL:'0x6666FF'}; 
    103101                        Debug.log(typ+' '+prm,obj[tgt]); 
    104                 } else if(Capabilities.playerType == 'External') { 
    105                         trace(tgt+': '+typ+' '+prm); 
    106102                } else if(config['tracer']) {  
    107103                        ExternalInterface.call(config['tracer'],tgt+': '+typ+' '+prm); 
     104                } else { 
     105                        trace(tgt+': '+typ+' '+prm); 
    108106                } 
    109107                if(!dat) { dat = new Object(); } 
  • branches/4.2/com/jeroenwijering/plugins/Controlbar.as

    r73 r75  
    11/** 
    2 * Display a controlbar and direct the search externally. 
     2* Display a controlbar with transport buttons and sliders. 
    33**/ 
    44package com.jeroenwijering.plugins { 
     
    404404        bar.stage.removeEventListener(MouseEvent.MOUSE_UP,upHandler); 
    405405                scrubber.icon.stopDrag(); 
    406                 if(scrubber.name == 'timeSlider' && view.playlist.length) { 
     406                if(scrubber.name == 'timeSlider' && view.playlist) { 
    407407                        mpl = view.playlist[view.config['item']]['duration']; 
    408                 } else if(scrubber.name == 'volumeSlider') {  
     408                } else if(scrubber.name == 'volumeSlider') { 
    409409                        mpl = 100; 
    410410                } 
  • branches/4.2/com/jeroenwijering/plugins/Display.as

    r66 r75  
    188188                                        break; 
    189189                                default: 
    190                                         if(view.config['icons'] == true) {  
     190                                        if(view.config['icons'] == true && view.playlist) { 
    191191                                                setIcon(view.config.displayclick+'Icon'); 
    192192                                        } else {  
  • branches/4.2/com/jeroenwijering/plugins/Playlist.as

    r73 r75  
    3333        /** Proportion between clip and mask. **/ 
    3434        private var proportion:Number; 
    35         /** Difference between mask and back height. **/ 
    36         private var maskdiff:Number = 0; 
    3735        /** Interval ID for scrolling **/ 
    3836        private var scrollInterval:Number; 
     
    7371                buttons = new Array(); 
    7472                try { 
    75                         maskdiff = clip.back.height - clip.masker.height; 
    7673                        image = new Array(clip.list.button.image.width,clip.list.button.image.height); 
    7774                } catch (err:Error) {} 
     
    8784                var wid = clip.back.width; 
    8885                var hei = clip.back.height; 
    89                 clip.masker.height = hei-maskdiff; 
     86                clip.masker.height = hei-clip.masker.y; 
    9087                clip.masker.width = wid; 
    9188                proportion = view.playlist.length*buttonheight/hei; 
     
    126123                scr.visible = true; 
    127124                scr.x = clip.back.width-scr.width; 
    128                 var dif = clip.back.height-scr.height; 
     125                var dif = clip.back.height-scr.height-scr.y; 
    129126                scr.back.height += dif; 
    130127                scr.rail.height += dif; 
     
    220217                        clip.back.height = view.config['height'];; 
    221218                        buildList(false); 
     219                        clip.visible = true; 
    222220                } else if (view.config['playlist'] == 'bottom') { 
    223221                        clip.x = 0; 
     
    228226                        clip.back.height = view.config['playlistsize']; 
    229227                        clip.back.width = view.config['width']; 
     228                        clip.visible = true; 
    230229                        buildList(false); 
    231230                } else if (view.config['playlist'] == 'over') { 
     
    234233                        clip.back.height = view.config['height']; 
    235234                        buildList(false); 
     235                        clip.visible = true; 
    236236                } else { 
    237237                        clip.visible = false; 
     
    261261        private function scrollHandler():void { 
    262262                var scr = clip.slider; 
    263                 var yps = scr.mouseY; 
     263                var yps = scr.mouseY-scr.rail.y; 
    264264                var ips = yps - scr.icon.height/2; 
    265265                var cps = clip.masker.y+clip.masker.height/2-proportion*yps; 
  • branches/4.2/com/jeroenwijering/utils/NetClient.as

    r59 r75  
    6262 
    6363 
    64         /** Some Limelight crap. **/ 
     64        /** CDN subscription callback. **/ 
    6565        public function onFCSubscribe(obj:Object):void { 
    6666                var dat = {type:'fcsubscribe'}; 
  • branches/4.2/com/jeroenwijering/utils/Playlister.as

    r57 r75  
    5252                        _playlist = new Array(); 
    5353                        for each (var ent in obj) { 
    54                                 if(typeof(ent) == 'object' && ent['file']) { _playlist.push(ent); } 
     54                                ent = ObjectParser.parse(ent); 
     55                                if(typeof(ent) == 'object' && ent['type']) {  
     56                                        _playlist.push(ent); 
     57                                } 
    5558                        } 
    5659                        if(_playlist.length == 0) { 
    57                                 var str = 'No file found. Did you set the "file" flashvar?'; 
     60                                var str = 'No suitable file found.'; 
    5861                                dispatchEvent(new ErrorEvent(ErrorEvent.ERROR,false,false,str)); 
    5962                        } else {  
Note: See TracChangeset for help on using the changeset viewer.