.dropDown {background-color: #b7c8d5;}
0) {
message.text = "";
roamer.currentItem = wordItem;
} else {
message.text = "'" + lastSearchWord + "' not found.";
// start a timer to get rid of the message in a few seconds
//message.alpha = 0.99;
message.visible = true;
messageTimer = new Timer(3000, 1);
messageTimer.addEventListener(TimerEvent.TIMER_COMPLETE, messageTimerExpired);
messageTimer.start();
}
}
/* called when the message timer expires */
public function messageTimerExpired(evt:TimerEvent):void
{
message.visible = false;
//messageHider.play();
}
/* Find a Meaning object corresponding to the given meaning. If we've already
created a Meaning object for that meaning, we return it. Otherwise we create a new
Meaning object. */
private function getMeaning(word: String, partOfSpeech: String, definition: String): ax_springgraph_thesaurus_Meaning {
var key: String = word + "/" + partOfSpeech + "/" + definition;
if(!meanings.hasOwnProperty(key)) {
var newMeaning: ax_springgraph_thesaurus_Meaning = new ax_springgraph_thesaurus_Meaning(word, partOfSpeech, definition);
meanings[key] = newMeaning;
graph.add(newMeaning);
}
return meanings[key];
}
/* Find a Word object corresponding to the given word. If we've already
created a Word object for that word, we return it. Otherwise we create a new
Word object. */
private function getWord(word: String): ax_springgraph_thesaurus_Word {
word = word.replace("*", "");
if(!words.hasOwnProperty(word)) {
var newWord: ax_springgraph_thesaurus_Word = new ax_springgraph_thesaurus_Word(word);
words[word] = newWord;
graph.add(newWord);
}
return words[word];
}
// makes the selected word the current word.
private function newWord(word: String): void {
//roamer.resetHistory();
textinput.text = "";
lastSearchWord = word;
thesaurus.send({q: word});
}
// Make the selected word the current work. Asks the server for info about the word.
public function showWord(word: String): void {
hideHelp();
lastSearchWord = word;
thesaurus.send({q: word});
}
// Make the selected item be the current item.
public function setCurrentItem(item: Item): void {
message.text = "";
lastSearchWord = (item is ax_springgraph_thesaurus_Word) ? (item as ax_springgraph_thesaurus_Word).id : (item as ax_springgraph_thesaurus_Meaning).word;
roamer.currentItem = item;
hideHelp();
}
/** Returns the one-and-only instance of Thesaurus (i.e. the main application) */
public static function get instance(): springgraph_thesaurus {
return Application.application as springgraph_thesaurus;
}
/* for use by itemRenderers, determines their glow filters */
public function calcFilters(currentItem: Item, item: Item): Array {
if(roamer.currentItem == item) {
return [new GlowFilter(0xffffff, 0.6, 10, 10, 2, 1)];
} else if(roamer.hasBeenCurrentItem(item)) {
return [new GlowFilter(0x0000FF, 0.3, 6, 6, 2, 1)];
} else {
return null;
}
}
/* for use by itemRenderers, determines their alpha */
public function getItemAlpha(visibleHistoryItems: Object, id: String): Number {
return visibleHistoryItems.hasOwnProperty(id) ? 0.7 : 1.0;
}
/* for use by itemRenderers, determines their text color */
public function getColor(item: Object, d: Object): int {
if (item == d)
return 0x0000ff;
else
return 0x222222;
}
/* for use by itemRenderers, determines their text weight */
public function getWeight(item: Object, d: Object): String {
if (item == d)
return "bold";
else
return "bold"; //"normal";
}
/* turns off the help. called when the user no longer needs help. */
private function hideHelp(): void {
help.visible = false;
}
/** pops up the about box */
private function doAbout(): void {
var aboutWindow: IFlexDisplayObject = new springgraph_thesaurus_AboutWindow();
PopUpManager.addPopUp(aboutWindow, this, true);
PopUpManager.centerPopUp(aboutWindow);
}
[Bindable]
// the graph of Words and Meanings
public var graph: Graph = new Graph();
// all the Meanings we've come across so far
private var meanings: Object = new Object();
// all the Words we've come across so far.
private var words: Object = new Object();
// the word of the most recent search
[Bindable]
private var lastSearchWord: String = "roaming";
private var messageTimer: Timer;
private var firstTime: Boolean = true;
]]>