Permalink
Browse files

Added some fixes to the Dash Media Player to allow the teaser to cont…

…rol the node with regard to voting and other operations.
  • Loading branch information...
1 parent 17db946 commit d113b4548cb13d922d2b2c3aa593aec09cd22e69 Travis Tidwell committed May 9, 2010
View
1 com/tmtdigital/dash/config/Variables.as
@@ -86,6 +86,7 @@ package com.tmtdigital.dash.config
public var taglinkcolor:uint = 0x6666FF;
public var tagplaylist:String = '';
public var teaserplay:Boolean = false;
+ public var teaserselect:Boolean = true;
public var termlinks:Boolean = true;
public var termspacing:Number = 5;
public var theme:String = "default";
View
2 com/tmtdigital/dash/display/node/Teaser.as
@@ -1 +1 @@
-/**
+/**
View
155 com/tmtdigital/dash/display/voter/DashVoter.as
@@ -1,154 +1 @@
-/**
- * Copyright 2008 - TMTDigital LLC
- *
- * Author: Travis Tidwell (www.travistidwell.com)
- * Version: 1.0
- * Date: June 9th, 2008
- *
- * Description: The DashVoterBase is used as a base class for any
- * voting widgets that are contained in the Dash Player. It is also
- * used to just display the votes of any current node in the players playlist.
- *
- **/
-
-package com.tmtdigital.dash.display.voter
-{
- import com.tmtdigital.dash.DashPlayer;
- import com.tmtdigital.dash.net.Service;
- import com.tmtdigital.dash.utils.Resizer;
- import com.tmtdigital.dash.utils.LayoutManager;
- import com.tmtdigital.dash.display.voter.TagVoter;
- import com.tmtdigital.dash.display.Skinable;
- import com.tmtdigital.dash.events.DashEvent;
- import com.tmtdigital.dash.utils.Utils;
- import com.tmtdigital.dash.net.Gateway;
- import com.tmtdigital.dash.config.Params;
-
- import flash.utils.*;
- import flash.events.*;
- import flash.display.*;
- import fl.transitions.*;
- import fl.transitions.easing.*;
-
- public class DashVoter extends Skinable
- {
- public function DashVoter( _skin:MovieClip, _type:String )
- {
- type = _type;
- var _skinPath:String = "";
-
- if( Params.flashVars.voter && Params.flashVars.votingenabled ) {
- _skinPath = Params.getRootPath();
- _skinPath += "/plugins/voters/" + Params.flashVars.voter + "/voter.swf";
- }
-
- super( _skin, _skinPath );
- }
-
- public override function getSkin( newSkin:MovieClip ) : MovieClip
- {
- if( rootSkin && (rootSkin.getVoter is Function) ) {
- return rootSkin.getVoter( type );
- }
-
- return newSkin;
- }
-
- public override function setSkin( _skin:MovieClip )
- {
- super.setSkin( _skin );
-
- if( skin ) {
- submitted = skin.submitted;
- submit = skin.submit;
-
- if( skin.tags ) {
- tags = new Object();
- var i:int = skin.tags.numChildren;
- while (i--)
- {
- var tag:* = skin.tags.getChildAt(i);
- var newTag:TagVoter = new TagVoter( tag );
- newTag.setTag( tag.name );
- newTag.addEventListener( DashEvent.VOTE_SET, voteHandler );
- newTag.addEventListener( DashEvent.VOTE_DELETE, voteHandler );
- newTag.addEventListener( DashEvent.PROCESSING, voteHandler );
- tags[tag.name] = newTag;
- }
- }
-
- visible = Params.flashVars.votingenabled;
- }
- }
-
- public function setVote( vote:Object )
- {
- if( vote && vote.tag ) {
- if( tags && tags[vote.tag] ) {
- tags[vote.tag].setVote( vote );
- }
- }
- }
-
- // Show the loader when votes are being processed, nothing otherwise.
- private function voteHandler( event:DashEvent )
- {
- if( event.type == DashEvent.VOTE_SET ) {
- if (submitted) {
- submitted.visible = true;
- }
-
- Gateway.setPlaylistVote( nodeId, event.args, Params.flashVars.disableplaylist );
- }
-
- DashPlayer.dash.node.spinner.visible = (event.type == DashEvent.PROCESSING);
- }
-
- // Loads the voter.
- public function loadVoter( node:Object )
- {
- alpha = 0;
- nodeId = node.nid;
- setFieldsMC( nodeId );
- }
-
- // Sets the voter fields.
- protected function setFieldsMC( nodeId:Number )
- {
- var shouldCache:Boolean = false;
-
- if (submit) {
- shouldCache = true;
- submit.buttonMode = true;
- submit.mouseChildren = false;
- submit.gotoAndStop("_up");
- submit.removeEventListener( MouseEvent.MOUSE_UP, onVoteSubmit );
- submit.addEventListener( MouseEvent.MOUSE_UP, onVoteSubmit );
- }
-
- if (submitted) {
- submitted.visible = false;
- }
-
- for each( var tag:TagVoter in tags ) {
- tag.getVotes( nodeId, shouldCache );
- }
- }
-
- // Called when the user presses the submit key.
- protected function onVoteSubmit( e:MouseEvent )
- {
- // We want to process all votes here...
- for each( var tag:TagVoter in tags ) {
- tag.processVotes();
- }
- }
-
- public var submitted:Sprite;
- public var submit:MovieClip;
- public var tags:Object;
-
- private var type:String;
- private var nodeId:Number;
- }
-}
+/**
View
2 com/tmtdigital/dash/display/voter/TagVoter.as
@@ -22,11 +22,13 @@
// Set up our voters.
vote = new Voter( _skin.vote );
+ vote.addEventListener( DashEvent.VOTE_GET, voteHandler );
vote.addEventListener( DashEvent.VOTE_SET, voteHandler );
vote.addEventListener( DashEvent.VOTE_DELETE, voteHandler );
vote.addEventListener( DashEvent.PROCESSING, voteHandler );
uservote = new Voter( _skin.uservote, true );
+ uservote.addEventListener( DashEvent.VOTE_GET, voteHandler );
uservote.addEventListener( DashEvent.VOTE_SET, voteHandler );
uservote.addEventListener( DashEvent.VOTE_DELETE, voteHandler );
uservote.addEventListener( DashEvent.PROCESSING, voteHandler );
View
4 com/tmtdigital/dash/display/voter/Voter.as
@@ -149,8 +149,8 @@
private function onVoteSet( vote:Object )
{
// Set the selected fill width
- setVote( {value: (userMode ? voteValue : vote.value)} );
- dispatchEvent( new DashEvent( DashEvent.VOTE_SET, vote ) );
+ setVote( {value: (userMode ? voteValue : vote.value)} );
+ dispatchEvent( new DashEvent( DashEvent.VOTE_SET, vote ) );
}
private function onVoteDelete( vote:Object )

0 comments on commit d113b45

Please sign in to comment.