Hi guys I wanted to create a closure to protect data for dynamically swapping between two video players on a page. i.e. Load one then unload and load another. In order to do this correctly I need to know which one is currently on stage.
I have extended the player object allowing me to call this data with: player.get_current_player()
Is this an acceptable way of performing this task? Am I creating any unnecessary overheads by hiding the data in this way and if so what would be a better way to do it?Code:function Player() { Player.prototype.set_current_player = function(player){ this.current_player = player; this.YouTube_initiated = false; this.flowplayer_initiated = false; }; Player.prototype.get_current_player = function() { return this.current_player; }; } var player = new Player(); ///// Instantiate player object used for flags and changing player id
thanks
Silversurfer



Reply With Quote




Bookmarks