Packagecom.whirled.contrib.card.graphics
Classpublic class TeamSprite
InheritanceTeamSprite Inheritance flash.display.Sprite

Represents a team display. Includes a placeholder box and last trick display.



Protected Properties
 PropertyDefined by
  _bids : Bids
The bids for the game
TeamSprite
  _lastTrick : LastTrickSprite
Sprite for the last trick display
TeamSprite
  _lastTrickPos : Point
Static position of our last trick display
TeamSprite
  _score : ScoreBar
Score score, e.g.
TeamSprite
  _scores : Scores
The scores for the game
TeamSprite
  _table : Table
The table we are sitting at
TeamSprite
  _team : Team
The seats of our team members
TeamSprite
  _tricks : ScoreBar
Tricks score, e.g.
TeamSprite
Public Methods
 MethodDefined by
  
TeamSprite(scores:Scores, team:int, height:int, lastTrickPos:Point, background:Class, nameTextColor:uint, nameTextOutlineColor:uint, scoreTextColor:uint, scoreTextOutlineColor:uint, labelTextColor:uint, labelTextOutlineColor:uint)
Create a new team sprite.
TeamSprite
  
Clear the card sprites.
TeamSprite
  
takeTrick(cards:Array, mainTrickPos:Point, winnerPos:Point):void
Take the array of card sprites and animate them to this team's last trick slot.
TeamSprite
Protected Methods
 MethodDefined by
  
bidListener(event:BidEvent):void
TeamSprite
  
makeNameString(name1:String, name2:String):String
[static] Utility function to truncate and concatenate two names.
TeamSprite
  
TeamSprite
  
setScore(current:int, target:int):void
Set the team's score display.
TeamSprite
  
updateTricks():void
Update the tricks/bid status text.
TeamSprite
Protected Constants
 ConstantDefined by
  FADE_DURATION : Number = .5
[static]
TeamSprite
  MAIN_TO_WINNER_DURATION : Number = 1.5
[static]
TeamSprite
  SLIDE_DELAY : Number = .5
[static]
TeamSprite
  TRICK_SCALE : Number = 0.5
[static]
TeamSprite
Property detail
_bidsproperty
protected var _bids:Bids

The bids for the game

_lastTrickproperty 
protected var _lastTrick:LastTrickSprite

Sprite for the last trick display

_lastTrickPosproperty 
protected var _lastTrickPos:Point

Static position of our last trick display

_scoreproperty 
protected var _score:ScoreBar

Score score, e.g. "172/300"

_scoresproperty 
protected var _scores:Scores

The scores for the game

_tableproperty 
protected var _table:Table

The table we are sitting at

_teamproperty 
protected var _team:Team

The seats of our team members

_tricksproperty 
protected var _tricks:ScoreBar

Tricks score, e.g. "1/5"

Constructor detail
TeamSprite()constructor
public function TeamSprite(scores:Scores, team:int, height:int, lastTrickPos:Point, background:Class, nameTextColor:uint, nameTextOutlineColor:uint, scoreTextColor:uint, scoreTextOutlineColor:uint, labelTextColor:uint, labelTextOutlineColor:uint)

Create a new team sprite. Long names will be truncated with an ellipsis.

Parameters
scores:Scores — the scores object for the game. Also used to access the Table and Bids
 
team:int — the index of the team that this sprite is for
 
height:int — the relative position of the scaled down last trick icon
 
lastTrickPos:Point — the height of the background image, needed for layout
 
background:Class — the embedded class containing the background image
 
nameTextColor:uint — the color of the player names text
 
nameTextOutlineColor:uint — the color of the outline applied to the player names
 
scoreTextColor:uint — the color of the score (and trick) text
 
scoreTextOutlineColor:uint — the color of the score (and trick) text outline
 
labelTextColor:uint — the color of the score (and trick) label text
 
labelTextOutlineColor:uint — the color of the score (and trick) label text outline
Method detail
bidListener()method
protected function bidListener(event:BidEvent):voidParameters
event:BidEvent
clearLastTrick()method 
public function clearLastTrick():void

Clear the card sprites.

makeNameString()method 
protected static function makeNameString(name1:String, name2:String):String

Utility function to truncate and concatenate two names.

Parameters
name1:String
 
name2:String

Returns
String
scoresListener()method 
protected function scoresListener(event:ScoresEvent):voidParameters
event:ScoresEvent
setScore()method 
protected function setScore(current:int, target:int):void

Set the team's score display.

Parameters
current:int
 
target:int
takeTrick()method 
public function takeTrick(cards:Array, mainTrickPos:Point, winnerPos:Point):void

Take the array of card sprites and animate them to this team's last trick slot. The animation includes x,y position and scale.

Parameters
cards:Array — the trick just won
 
mainTrickPos:Point — the global coordinates of the position of the winning player
 
winnerPos:Point
updateTricks()method 
protected function updateTricks():void

Update the tricks/bid status text.

Constant detail
FADE_DURATIONconstant
protected static const FADE_DURATION:Number = .5
MAIN_TO_WINNER_DURATIONconstant 
protected static const MAIN_TO_WINNER_DURATION:Number = 1.5
SLIDE_DELAYconstant 
protected static const SLIDE_DELAY:Number = .5
TRICK_SCALEconstant 
protected static const TRICK_SCALE:Number = 0.5