com.theoworlds.builder.TextBubble

TextBubble class - chat “bubbles” that appear above characters when they “talk”

Version

1.0

Author

© TheoWorlds.com, 2007--2009.

Summary
com.theoworlds.builder.TextBubbleTextBubble class - chat “bubbles” that appear above characters when they “talk”
Variables
_IDid of TextBubble
_characterIDid of Character
_containerMCjust in case.
_frameMC
_text
_frameWidthwidth of {TextBubble._frameMC}
_frameHeightheight of {TextBubble._frameMC}
_textPaddingspace between the text box and the graphics frame
_maxTextWidthindicates the maximum number of characters
_pointerCenterOffsetoffset of the pointer from the center
_pointerCenterWidthoffset of the pointer from the center
_pointerCenterHeightoffset of the pointer from the center
_targetMCcontainer movie clip.
_bgColor
_borderColor
_message
emoticonsUrl
baseLineHeight
SMILE_HEIGHT
SMILE_WIDTH
oneLineHeight
textFormat
Functions
TextBubbleConstructor
setupEmoticons
setEmoticonText
redrawwhen a character reaches the end of the screem the text bubble stays entirely within the screen the bubble pointer keeps pointing at the character
drawdraws the text bubble
killremove text buuble
Properties
IDid
characterIDcharacter id
containerMCthe bubble movieclip
textthe movieclip text

Variables

_ID

private var _ID: Number

id of TextBubble

_characterID

private var _characterID: Number

id of Character

_containerMC

private var _containerMC: MovieClip

just in case. like for implementing a more complex bubble--positioning algorithm based on character’s position

_frameMC

private var _frameMC: MovieClip

_text

private var _text: TextField

_frameWidth

private var _frameWidth: Number

width of {TextBubble._frameMC}

_frameHeight

private var _frameHeight: Number

height of {TextBubble._frameMC}

_textPadding

private static var _textPadding: Number

space between the text box and the graphics frame

_maxTextWidth

private static var _maxTextWidth: Number

indicates the maximum number of characters

_pointerCenterOffset

private static var _pointerCenterOffset: Number

offset of the pointer from the center

_pointerCenterWidth

private static var _pointerCenterWidth: Number

offset of the pointer from the center

_pointerCenterHeight

private static var _pointerCenterHeight: Number

offset of the pointer from the center

_targetMC

private var _targetMC: MovieClip

container movie clip. should be empty

_bgColor

private var _bgColor: Number

_borderColor

private var _borderColor: Number

_message

private var _message: String

emoticonsUrl

private static var emoticonsUrl: Array

baseLineHeight

private static var baseLineHeight: Number

SMILE_HEIGHT

private static var SMILE_HEIGHT: Number

SMILE_WIDTH

private static var SMILE_WIDTH: Number

oneLineHeight

private static var oneLineHeight: Number

textFormat

private static var textFormat: TextFormat

Functions

TextBubble

public function TextBubble(ID: Number,
characterID: Number,
target: MovieClip,
posX: Number,
posY: Number,
txt: String,
initObj: Object)

Constructor

Parameters

ID-- id of TextBubble
characterID-- id of Character
target-- the mc in wich it is created
posX-- x coordinate of a buble relative to the local coordinates of the target movie clip
posY-- y coordinate of a buble relative to the local coordinates of the target movie clip
txt-- text
initObj

setupEmoticons

public static function setupEmoticons():Void

setEmoticonText

private function setEmoticonText(ID: Number,
characterID: Number,
target: MovieClip,
posX: Number,
posY: Number,
txt: String,
initObj: Object):Void

redraw

public function redraw(deltaX: Number,
deltaY: Number):Void

when a character reaches the end of the screem the text bubble stays entirely within the screen the bubble pointer keeps pointing at the character

Parameters

deltaX- shift by X
deltaY- shift by Y

draw

private function draw(target : MovieClip,
x : Number,
y : Number,
w : Number,
h : Number,
r, 
c, 
alpha: Number,
rot: Number,
gradient : String,
ratios: Array,
//bg borderThickness : Number,
borderColor : Number,
borderAlpha : Number,
pointerWidth: Number,
pointerHeight: Number,
centerOffset: Number,
clearPrevious: Boolean):Void

draws the text bubble

Parameters

target
xx position of fill
yy position of fill
wwidth of fill
hheight of fill
rcorner radius of fill :: number or object {br:#,bl:#,tl:#,tr:#}
chex color of fill :: number or array [0x######,0x######]
alphaalpha value of fill :: number or array [0x######,0x######]
rotrotation of fill :: number or matrix object {matrixType:”box”,x:#,y:#,w:#,h:#,r:(#*(Math.PI/180))}
gradienttype of gradient “linear” or “radial”
ratios(optional :: default [0,255]) -- specifies the distribution of colors :: array [#,#];
borderThickness
borderColor
borderAlpha
pointerWidth
pointerHeight
centerOffset
clearPrevious

kill

public function kill():Void

remove text buuble

Properties

ID

public function get ID():Number

Returns

id

characterID

public function get characterID():Number

Returns

character id

containerMC

public function get containerMC():MovieClip

Returns

the bubble movieclip

text

public function get text():String

Returns

the movieclip text

private var _ID: Number
id of TextBubble
private var _characterID: Number
id of Character
Character class -- character/avatar main class
private var _containerMC: MovieClip
just in case.
private var _frameMC: MovieClip
private var _text: TextField
private var _frameWidth: Number
width of {TextBubble._frameMC}
private var _frameHeight: Number
height of {TextBubble._frameMC}
private static var _textPadding: Number
space between the text box and the graphics frame
private static var _maxTextWidth: Number
indicates the maximum number of characters
private static var _pointerCenterOffset: Number
offset of the pointer from the center
private static var _pointerCenterWidth: Number
offset of the pointer from the center
private static var _pointerCenterHeight: Number
offset of the pointer from the center
private var _targetMC: MovieClip
container movie clip.
private var _bgColor: Number
private var _borderColor: Number
private var _message: String
private static var emoticonsUrl: Array
private static var baseLineHeight: Number
private static var SMILE_HEIGHT: Number
private static var SMILE_WIDTH: Number
private static var oneLineHeight: Number
private static var textFormat: TextFormat
public function TextBubble(ID: Number,
characterID: Number,
target: MovieClip,
posX: Number,
posY: Number,
txt: String,
initObj: Object)
Constructor
public static function setupEmoticons():Void
private function setEmoticonText(ID: Number,
characterID: Number,
target: MovieClip,
posX: Number,
posY: Number,
txt: String,
initObj: Object):Void
public function redraw(deltaX: Number,
deltaY: Number):Void
when a character reaches the end of the screem the text bubble stays entirely within the screen the bubble pointer keeps pointing at the character
private function draw(target : MovieClip,
x : Number,
y : Number,
w : Number,
h : Number,
r, 
c, 
alpha: Number,
rot: Number,
gradient : String,
ratios: Array,
//bg borderThickness : Number,
borderColor : Number,
borderAlpha : Number,
pointerWidth: Number,
pointerHeight: Number,
centerOffset: Number,
clearPrevious: Boolean):Void
draws the text bubble
public function kill():Void
remove text buuble
public function get ID():Number
id
public function get characterID():Number
character id
public function get containerMC():MovieClip
the bubble movieclip
public function get text():String
the movieclip text
Close