| 1 | /** |
|---|
| 2 | * Abstract superclass for the View. Defines all methods accessible to plugins. |
|---|
| 3 | * |
|---|
| 4 | * Import this class into your project/plugin for strong-typed api references. |
|---|
| 5 | **/ |
|---|
| 6 | package com.jeroenwijering.events { |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | import flash.display.MovieClip; |
|---|
| 10 | import flash.events.EventDispatcher; |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | public class AbstractView extends EventDispatcher { |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | /** Constructor. **/ |
|---|
| 17 | public function AbstractView() {}; |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | /** Getter for config, the hashmap with configuration settings. **/ |
|---|
| 21 | public function get config():Object { return new Object(); }; |
|---|
| 22 | /** Getter for playlist, an array of hashmaps (file,link,image,etc) for each playlistentry. **/ |
|---|
| 23 | public function get playlist():Array { return new Array(); }; |
|---|
| 24 | /** Getter for skin, the on-stage player graphics. **/ |
|---|
| 25 | public function get skin():MovieClip { return new MovieClip(); }; |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | /** |
|---|
| 29 | * *(Un)subscribe to events fired by the Controller (seek,load,resize,etc). |
|---|
| 30 | * |
|---|
| 31 | * @param typ The specific event to listen to. |
|---|
| 32 | * @param fcn The function that will handle the event. |
|---|
| 33 | * @see ControllerEvent |
|---|
| 34 | **/ |
|---|
| 35 | public function addControllerListener(typ:String,fcn:Function):void {}; |
|---|
| 36 | public function removeControllerListener(typ:String,fcn:Function):void {}; |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | /** |
|---|
| 40 | * (Un)subscribe to events fired by the Model (time,state,meta,etc). |
|---|
| 41 | * |
|---|
| 42 | * @param typ The specific event to listen to. |
|---|
| 43 | * @param fcn The function that will handle the event. |
|---|
| 44 | * @see ModelEvent |
|---|
| 45 | **/ |
|---|
| 46 | public function addModelListener(typ:String,fcn:Function):void {}; |
|---|
| 47 | public function removeModelListener(typ:String,fcn:Function):void {}; |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | /** |
|---|
| 51 | * (Un)subscribe to events fired from the View (play,mute,stop,etc). |
|---|
| 52 | * All events fired by plugins or the actionscript/javascript API flow through the View. |
|---|
| 53 | * |
|---|
| 54 | * @param typ The specific event to listen to. |
|---|
| 55 | * @param fcn The function that will handle the event. |
|---|
| 56 | * @see ViewEvent |
|---|
| 57 | **/ |
|---|
| 58 | public function addViewListener(typ:String,fcn:Function):void {}; |
|---|
| 59 | public function removeViewListener(typ:String,fcn:Function):void {}; |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | /** |
|---|
| 63 | * Get a reference to a specific plugin. |
|---|
| 64 | * |
|---|
| 65 | * @param nam The name of the plugin to return. |
|---|
| 66 | * @return A reference to the plugin itself. Public methods can be directly called on this. |
|---|
| 67 | * @see SPLoader |
|---|
| 68 | **/ |
|---|
| 69 | public function getPlugin(nam:String):Object { return {}; }; |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | /** |
|---|
| 73 | * Get a reference to a specific plugin. |
|---|
| 74 | * |
|---|
| 75 | * @param obj The plugin whose config we want. |
|---|
| 76 | * @return The plugin config options, as a hashmap. |
|---|
| 77 | * @see SPLoader |
|---|
| 78 | **/ |
|---|
| 79 | public function getPluginConfig(obj:Object):Object { return {}; }; |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | /** |
|---|
| 83 | * Load a plugin into the player at runtime. |
|---|
| 84 | * |
|---|
| 85 | * @prm url The url of the plugin to load. |
|---|
| 86 | * @prm vrs A string of flashvars for the plugin |
|---|
| 87 | * (separated by & and = signs, no 'pluginname.' variable needed). |
|---|
| 88 | * @return Boolean true if succeeded. |
|---|
| 89 | **/ |
|---|
| 90 | public function loadPlugin(url:String,vrs:String=null):Boolean { |
|---|
| 91 | return true; |
|---|
| 92 | }; |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | /** |
|---|
| 96 | * Dispatch an event. The event will be serialized and fired by the View. |
|---|
| 97 | * |
|---|
| 98 | * @param typ The specific event to fire to. |
|---|
| 99 | * @param prm The accompanying parameter. Some events require one, others not. |
|---|
| 100 | * @see ViewEvent |
|---|
| 101 | **/ |
|---|
| 102 | public function sendEvent(typ:String,prm:Object=undefined):void {}; |
|---|
| 103 | |
|---|
| 104 | |
|---|
| 105 | } |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | } |
|---|