Start Learning Japanese in the next 30 Seconds with
a Free Lifetime Account

Or sign up using Facebook

Japanese Scrabble

Moderators: Moderator Team, Admin Team

videovillain
Been Around a Bit
Posts: 32
Joined: June 28th, 2013 2:01 am

Re: Japanese Scrabble

Postby videovillain » August 14th, 2013 12:36 pm

cloa513ch2629 wrote:Then its not really object orientated- functions are objects too- actually almost discrete expression is an object.

It is object oriented...

Lets try this again:
The short answer: yes.
The better answer: like all OOP languages, you separate classes into files (though you don't have to), and therefore, you should be putting your functions in classes and separating them into files. If you just need a function without data, you could make a globally accessible static function in a class (just like the Math class works, Math.random, Math.round, etc.). You can also just have functions floating around in files (they would then be global functions), but that's not proper programming. Also, you would have to make sure that you're compiling those files in (most dev environments do that automatically by including your project's src directory, but if you're just having functions float around in files, I'd bet you're not using a normal dev environment).

cloa513ch2629
Established Presence
Posts: 81
Joined: June 1st, 2013 4:00 am

Re: Japanese Scrabble

Postby cloa513ch2629 » August 14th, 2013 10:44 pm


Get 40% OFF
team.relationships
Expert on Something
Posts: 222
Joined: June 18th, 2012 11:00 am

Re: Japanese Scrabble

Postby team.relationships » August 26th, 2013 4:50 am

Hi Cloa-san and Videovillain-san,

How is the creating of the scrabble going? Can we try yet? :wink:

Cheers,

Gergő
Team JapanesePod101.com

cloa513ch2629
Established Presence
Posts: 81
Joined: June 1st, 2013 4:00 am

Re: Japanese Scrabble

Postby cloa513ch2629 » September 2nd, 2013 8:24 am

I am giving up.

FlashDevelop is absolute rubbish. It would compile the most basic Keyboard event.

stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown);
function myKeyDown(e:KeyboardEvent):void{
if (e.keyCode ==Keyboard.SPACE)
{
removeChild(Start1);
Start1 = null;
}
That code is straight from Adobe.


Error: Access of undefined property Keyboard.
if (e.keyCode ==Keyboard.SPACE)

cloa513ch2629
Established Presence
Posts: 81
Joined: June 1st, 2013 4:00 am

Re: Japanese Scrabble

Postby cloa513ch2629 » September 4th, 2013 2:38 am

I got a bit further but now a textfield command won't do anything other make a box with white contents.

cloa513ch2629
Established Presence
Posts: 81
Joined: June 1st, 2013 4:00 am

Re: Japanese Scrabble

Postby cloa513ch2629 » October 13th, 2013 9:21 am

Now I getting this ridiculous error.
Look how much work I have done on it- worked a bit in a previous form
VideoVillain or someone else can you help or else I abandon all my work.


Error #1007: コンストラクター以外にインスタンス化が試行されました。
Constructor error

In Main.as
package
{
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.*;
import flash.ui.Keyboard;
import flash.accessibility.AccessibilityImplementation;
import flash.display.Bitmap;
import flash.display.MovieClip;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.display.Sprite;
import flash.utils.ByteArray;
import flash.events.MouseEvent;
import flash.text.AntiAliasType;
import flash.utils.describeType;
import boxsprite;
import flash.net.*;
import flash.display.Stage;
import board;
import flash.events.KeyboardEvent;
import flash.ui.KeyboardType;
import Set;
public class Main extends Sprite
{
[Embed(source="../lib/Board.jpg")]
private var boardClass :Class;

public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private var t1:Sprite;
private var t2:Sprite;
private var t3:Sprite;
private var t4:Sprite;
private var t5:Sprite;
private var t6:Sprite;
private var t7:Sprite;
private var base:Sprite;
private var boardonScreen:Bitmap;
private var box1:Sprite;
private function init():void
{removeEventListener(Event.ADDED_TO_STAGE, init);
boardonScreen= new boardClass() as Bitmap;
boardonScreen.x = 0;
boardonScreen.y = 0;
stage.addChild(boardonScreen);
box1 = new boxsprite();
box1.x = 480;
box1.y = 0;
stage.addChild(box1);
base = new tile();
base.x =672;
base.y = 448;
stage.addChild(base);
t1 = new tile();
t1.x = 480;
t1.y = 448;
stage.addChild(t1);
t2 = new tile();
t2.x = 480;
t2.y = 416;
stage.addChild(t2);
t3 = new tile();
t3.x = 480;
t3.y = 384;
stage.addChild(t3);
t4 = new tile();
t4.x = 480;
t4.y = 352;
stage.addChild(t4);
t5 = new tile();
t5.x = 480;
t5.y = 320;
stage.addChild(t5);
t6 = new tile();
t6.x = 480;
t6.y = 288;
stage.addChild(t6);
t7 = new tile();
t7.x = 480;
t7.y = 256;
stage.addChild(t7);}}}


In tile.as



package {
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.*;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.text.*;
import flash.text.TextField;
import flash.ui.Keyboard;
import flash.utils.*;
import Math;
import Set;
import StatusBox;
///These import functions are used to ease the button back into place after a drag
public class tile extends Sprite
{ private var kana:String;
private var value:uint;
//private const backingcolour:uint = 0xe0e0e0;
private var type:uint;
private var isSetBox:Boolean;
private static var valueaggreg:uint; //value of kanjitile
static private var ret:Boolean; //do you return tiles from board
static private var yplace:uint = 0;
//private var m_nDoubleClickSpeed:Number = 300;
//private var m_toMouse:Number;
private var xx:int;
private var yy:uint;
private var initialx:uint;
private var initialy:uint;
private var finalx:uint;
private var finaly:uint;
private var id:uint;
private var selectghostList:Vector.<String>=new<String>["ま,マ","む,ム","も,モ","か,カ","く,ク","こ,コ","な,ナ","ぬ,ヌ","の,ノ","ば,バ","ぶ,ブ","ぼ,ボ","は,ハ","ふ,フ","ほ,ホ","ぱ,パ","ぷ,プ","ぽ,ポ"];
private var selectkanaList:Vector.<String>=new <String>["みゃ,ミャ", "みゅ,ミャ", "みょ,ミョ", "きゃ,キャ", "きゅ,キュ", "きょ,キョ", "にゃ,ニャ", "にゅ,ニュ", "にょ,ニョ", "びゃ,びゃ", "びゅ,ビュ", "びょ,ビョ", "  ひゃ,ヒャ", "ひゅ,ヒュ", "ひょ,ヒョ", "ぴゃ,ピャ", "ぴゅ,ピュ", "ぴょ,ピョ"];
private var selectghostvalueList:Vector.<uint> = new <uint>[2, 2, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2];
private const multiplier:Array = [["TW","1","1","DL","1","1","1","TW","1","1","1","DL","1","1","TW"],["1","DW","1","1","1","TL","1","1","1","TL","1","1","1","DW","1"],["1","1","DW","1","1","1","DL","1","DL","1","1","1","DW","1","1"],["DL","1","1","DW","1","1","1","DL","1","1","1","DW","1","1","DL"],["1","1","1","1","DW","1","1","1","1","1","DW","1","1","1","1"],["1","TL","1","1","1","TL","1","1","1","TL","1","1","1","TL","1"],["1","1","DL","1","1","1","DL","1","DL","1","1","1","DL","1","1"],["TW","1","1","DL","1","1","1","DL","1","1","1","DL","1","1","TW"],["1","1","DL","1","1","1","DL","1","DL","1","1","1","DL","1","1"],["1","TL","1","1","1","TL","1","1","1","TL","1","1","1","TL","1"],["1","1","1","1","DW","1","1","1","1","1","DW","1","1","1","1"],["DL","1","1","DW","1","1","1","DL","1","1","1","DW","1","1","DL"],["1","1","DW","1","1","1","DL","1","DL","1","1","1","DW","1","1"],["1","DW","1","1","1","TL","1","1","1","TL","1","1","1","DW","1"],["TW","1","1","DL","1","1","1","TW","1","1","1","DL","1","1","TW"]];
private var vis:Boolean = true; //visibility
private var isSet:Boolean;
[Embed(source = "C:/Users/Makiko/Desktop/Michael/Games/Test/New Project/lib/Tile.png")]
private var tileClass:Class
private var kanaList:Vector.<String> = new <String>["あ,ア", "あ,ア", "え,エ", "え,エ", "い,イ", "い,イ", "お,オ", "お,オ", "う,ウ", "う,ウ", "う,ウ", "う,ウ", "か,カ", "か,カ", "け,ケ", "け,ケ", "き,キ", "き,キ", "く,ク", "く,ク", "こ,コ", "こ,コ", "さ,サ", "さ,サ", " し,シ", " し,シ", "す,ス", "す,ス", "そ,ソ", "そ,ソ", "す,ス", "す,ス", "た,タ", "た,タ", "て,テ", "て,テ", " ち,チ", " ち,チ", "と,ト", "と,ト", "つ,ツ", "つ,ツ", "ら,ラ", "ら,ラ", "れ,レ", "れ,レ", "り,リ", "り,リ", "ろ,ロ", "ろ,ロ", "る,ル", "る,ル", "だ,ダ", "で,デ", "じ,ジ", "ど/ド", "ず,ズ", "ざ,ザ", "ぜ,ゼ", "ぞ/ゾ", "な,ナ", "ね,ネ", "に,二", "の,ノ", "ぬ,ヌ", "じゃ,ジャ", "じゅ,ジュ", "じょ,ジョ", "ん,ン", "しゃ,シャ", "しゅ,シュ", "しょ,ショ", "や,ヤ", "ゆ,ユ", "よ,ヨ", "は,ハ", "ひ,ヒ", "ふ,フ", "へ,ヘ", "ほ,ホ", "ば,バ", "ば,バ", "ぶ,ブ", "ぶ,ブ", "び,ビ", "び,ビ", "ぼ,ボ", "ぼ,ボ", "べ,ベ", "べ,ベ", "ぱ,パ", "ぴ/ピ", "ぷ,プ", "ぺ,ペ", "ぽ,ポ", "ま,マ", "み,ミ", " む,ム", "め,メ", "も,モ", "を/ヲ", "みゃ,ミャ", "みゅ,ミャ", "みょ,ミョ", "きゃ,キャ", "きゅ,キュ", "きょ,キョ", "にゃ,ニャ", "にゅ,ニュ", "にょ,ニョ", "びゃ,びゃ", "びゅ,ビュ", "びょ,ビョ", "ひゃ,ヒャ", "ひゅ,ヒュ", "ひょ,ヒョ", "ぴゃ,ピャ", "ぴゅ,ピュ", "ぴょ,ピョ", "っ,ッ", "っ,ッ"];
private var valueList:Vector.<uint>= new <uint>[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 10, 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 20, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1, 1];
// Lists of Kana that can be replaced in the replace mode and the substitute Kana and Values
//Start list of playerHand contents as I don't know if Null is 0
private var playernumber:uint; //total number of players
private var allplayersHand:Array = [[], [], [], [],[], []];
private var playerRound:uint = 1; //which player
private var round:uint = 1; //round of the game
private var aplayersHand:Array; // hand of the current player
private var mode:uint;
private var tileImage:Bitmap;
private static var idvar:uint;
static private var first:Boolean = true;
private var special:Boolean = false;
static private var handstatus:Vector.<String>;
//handstatus types are idle: free, ret: ready to return to stock, set: set on board, rem: ready to removed, not
public function tile()
{ addEventListener(Event.ADDED_TO_STAGE, standarddisplay); }

private function standarddisplay(e:Event=void) : void
{trace("Project is running fine!");
removeEventListener(Event.ADDED_TO_STAGE, standarddisplay);
tileImage = new tileClass as Bitmap;
addChild(tileImage);
//Draws the japanese letter on the tile
var kanafield:TextField = new TextField();
kanafield.width = 40;
kanafield.height = 20;
kanafield.x = -2;
kanafield.y = -5;
kanafield.text == "";
trace(kanafield.text);
kanafield.wordWrap = true;
kanafield.background = true;
var kanafieldformat:TextFormat = new TextFormat();
kanafieldformat.size = 12;
kanafieldformat.font = "Arial";
kanafield.setTextFormat(kanafieldformat);
this.addChild(kanafield);
kanafield.mouseEnabled = false;
//Draw the number on the tile
valuefield= new TextField();
valuefield.width = 30;
valuefield.height = 10;
valuefield.x = 0;
var valuefieldformat:TextFormat = new TextFormat;
valuefieldformat.size = 7;
valuefield.text = "";
valuefield.y = 15;
valuefield.background = false;
valuefield.setTextFormat(valuefieldformat);
this.addChild(valuefield);
valuefield.mouseEnabled = false;
//Add an event listener to the tile on the stage
checktype(); }
private function checktype():void
{if (first != true)
{ id = idvar;
idvar += 1;
value = playerhandvalue[id];
stage.addEventListener(KeyboardEvent.KEY_DOWN,keyboardinput);
this.addEventListener(StatusBox.STATUSBOXCHANGED,moderesponse);
this.addEventListener(StatusBox.HIDE, SetAlpha);
isSetBox = false }
else
{ special = true;
first = false;
this.addEventListener(Set.BOX_SET_CHANGED,btr)
init();}}
private function init():void
{ trace("starting");
stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown);
stage.addEventListener(MouseEvent.MOUSE_UP, dnp);}
private function dnp(e:MouseEvent):void
{ stage.removeEventListener(KeyboardEvent.KEY_DOWN,myKeyDown);
stage.removeEventListener(MouseEvent.MOUSE_UP, dnp);
trace(playernumber);
create(); }
private function myKeyDown(e2:KeyboardEvent):void
{ if (e2.keyCode == Keyboard.NUMBER_1)
{playernumber = 1;
trace(playernumber);}
else if (e2.keyCode == Keyboard.NUMBER_2)
{playernumber = 2;
trace(playernumber)}
else if (e2.keyCode == Keyboard.NUMBER_3)
{playernumber = 3;
trace(playernumber);}
else if (e2.keyCode == Keyboard.NUMBER_4)
{playernumber = 4;
trace(playernumber); }
else if (e2.keyCode == Keyboard.NUMBER_5)
{playernumber = 5;
trace(playernumber);}
else if (e2.keyCode == Keyboard.NUMBER_6)
{playernumber = 6; }
else {playernumber = 1;}}
private function create():void
{ var listLength:uint;
var row:uint
aplayersHand = allplayersHand[playerRound];
for (var i:uint = (aplayersHand.length-1); i <= 6; i+=1)
{ listLength = kanaList.length;
row = int(Math.random() * listLength);  
trace (row);
trace(i);
aplayersHand[i] = [0, kanaList[row], valueList[row],]
trace (aplayersHand);
trace (aplayersHand[i]);
kanaList.splice(row,1);
valueList.splice(row, 1);
playerhandkana.push(kanaList[row]);
playerhandvalue.push(valueList[row]);}
dispatchEvent( new StatusBox(StatusBox.STATUSBOXCHANGED, 1)); }
private function moderesponse(e:StatusBox):void
{ mode = e.mode;
cleanup();
if (special == false)
{
if (mode == 1)
{ this.visible = true;
this.kanafield.visible = true;
this.valuefield.visible = true;
this.x = 480;
this.y = (480 - (id*32));
kana = playerhandkana[id];
value = playerhandvalue[id];
kanafield.text = kana;
valuefield.text = String(value);
this.addEventListener(MouseEvent.MOUSE_DOWN, draglocation);
}
else if (mode == 4)
{if (handstatus[id] == "rem")
{handstatus[id] = "idle"; } } }
else if (special == true)
{ if (mode == 8)
{stage.addEventListener(KeyboardEvent.KEY_DOWN, keyboardinput);
for (var i:uint = 0; (handstatus.length - 1); i += 1)
{if (handstatus[i] == "ret")
{kanaList.push(playerhandkana[i]);
valueList.push(playerhandvalue[i]);
endgame = true;} }
if (endgame == true)
{ dispatchEvent(new StatusBox(StatusBox.STATUSBOXCHANGED, 9, false, false));}
else {{var cfh:Boolean = checkforwordtype(horzword);
var cfv:Boolean = (checkforwordtype(vertword));
var hl2:uint;
if ((handstatus.length > 1 && (cfh == false) && (cfv == false)))
{dispatchEvent(new StatusBox(StatusBox.STATUSBOXCHANGED, 10, false, false));}
if (generalx.length == 0)
{for (var j:uint = 0; (handstatus.length - 1); i += 1)
{if (handstatus[i] == "set")
{hl2 += 1 } }
if (hl2 == 1)
{dispatchEvent(new StatusBox(StatusBox.STATUSBOXCHANGED, 10, false, false)); }}
if ((cfh == true) && (cfv == true))
{dispatchEvent(new StatusBox(StatusBox.STATUSBOXCHANGED, 10, false, false)); }
else if (cfh == true)
{calctotalscore(valuehor, valuevert);}
else if (cfv == true)
{calctotalscore(valuevert, valuehor); } } }
for (var k:uint = 0; k < (handstatus.length - 1); k += 1)
{ if(handstatus[i] == "idle" || "rem")
{ var o:uint=0
allplayersHand[playernumber][o] = [kana, value];
o += 1; }}}
else if (mode == 9)
{if (ret == true)
{ ret = false;
for (var m:uint = 0; m < (handstatus.length - 1); m += 1)
{ if(handstatus[i] == "set")
{ var p:uint=0
allplayersHand[playernumber][p] = [kana, value];
p += 1; }}
dispatchEvent(new StatusBox(StatusBox.STATUSBOXCHANGED, 1, false, false));}
else { setinplace();
dispatchEvent(new StatusBox(StatusBox.STATUSBOXCHANGED, 1, true, true));
} }
else if (mode == 10)
{isSet = false;
isSetBox = false;
this.visible = false;
create();}}}
private function btr(e:Set):void
{if (e.valueex > 0)
{ if (e.kanaex == "kanji")
{kanafield.type = TextFieldType.INPUT;
value += e.valueex;
valuefield.text = String(value);}
else if (e.kanaex == "k+" )
{value += e.valueex;
valuefield.text = String(value);}
else if (e.kanaex == "k-")
{value-= e.valueex;
valuefield.text = String(value);}
else if (e.kanaex == "nokanji")
{kanafield.type = TextFieldType.DYNAMIC;
value = 0;
kana = "";
valuefield.text = "";}}
else
{if (kana == "")
{ if (e.valueex == 0)
{kana =selectghostList[selectkanaList.indexOf(e.kanaex, 0)];
value = selectghostvalueList[selectkanaList.indexOf(kana, 0)];
kanafield.text = kana;
valuefield.text = String(value);}
else
{kana = "";
value = 0;
kanafield.text = "";
valuefield.text = "";}}}}
private var error:String;
private function SetAlpha(e:StatusBox):void
{ if (isSetBox == true)
{this.alpha = 0;
this.mouseEnabled = false; } }
static private var scorelist:Array = [[]];
private function setinplace():void {
if (isSet==true) {
/*var lob1:Sprite = new lob(kana, value);
lob1.x = xx;
lob1.y = yy;
stage.addChild(lob1);*/
removeEventListener(StatusBox.SETDOWN, setinplace);
stage.removeChild(this);}
else {stage.removeChild(this);} }
static private var turnscore:uint;
static private function calctotalscore(main:Vector.<uint>,side:Vector.<uint>):uint
{ var tws:uint;
var twm:uint;
var amws:uint;
var asws:uint;
for (var i:uint = 0; (handstatus.length - 1); i += 1)
{if (handstatus[i] == "set")
{ if (side[i] > 0)
{asws += (side[i] + (exclusionvalue[i] * LM[i])) * WM[i]; }
amws += main[i] + (exclusionvalue[i] * LM[i])
twm += WM[i]
generalx.push(exclusionx[i]);
generaly.push(exclusiony[i]);
generalkana.push(exclusionkana[i]);
generalvalue.push(exclusionvalue[i]);}}
exclusionx = new Vector.<uint>
exclusiony = new Vector.<uint>
exclusionkana = new Vector.<String>
exclusionvalue= new Vector.<uint>
tws = (asws + amws) * twm;
return tws;}
private function checkforwordtype(wordcheck:Vector.<Boolean>):Boolean
{ for (var i:uint = 0; handstatus.length - 1; i += 1)
{ var check:Boolean = false;
if (handstatus[i] == "set")
{if (wordcheck[i] == true)
{check = true;}}}
return check;}
private var endgame:Boolean;
private var playerhandkana:Vector.<String> = new Vector.<String>(7);
private var playerhandvalue:Vector.<uint> = new Vector.<uint>(7);
private var valuefield:TextField;
private function keyboardinput(e:KeyboardEvent):void
{ if (mode == 2 || 3 || 4 || 5||8)
{if (e.keyCode == Keyboard.I)
{ vis = !vis;
if ((isSet=false)&&(isSetBox=false))
{this.visible = vis;
this.kanafield.visible = vis;
this.valuefield.visible = vis;}}}
if (mode == 8)
{if (e.keyCode == Keyboard.R)
{ret = !ret; }}}
private var kanafield:TextField = new TextField();
static private var generalx:Vector.<uint>;
static private var generaly:Vector.<uint>;
static private var generalkana:Vector.<String>;
static private var generalvalue:Vector.<uint>;
static private var exclusionx:Vector.<uint>;
static private var exclusiony:Vector.<uint>;
static private var exclusionvalue:Vector.<uint>;
static private var exclusionkana:Vector.<String>;
private function addExclusion():void
{exclusionx[id]=xx;
exclusiony[id] = yy;
exclusionkana[id] = kana;
exclusionvalue[id] = value; }
private function removeExclusion():void
{ exclusionvalue[id] = 0;
exclusionkana[id] = "0";
exclusionx[id] = 0;
exclusiony[id] = 0; }
//The initial event performed when the button is first clicked;
private function draglocation(e:MouseEvent):void
{ removeEventListener(MouseEvent.MOUSE_DOWN, draglocation);
initialx = this.x;
initialy = this.y;
if (isSet==false ||isSetBox == false)
{ stage.addChild(this)
this.startDrag();
this.addEventListener(MouseEvent.MOUSE_UP, clickcheck);} }
private function clickcheck(e:Event):void
{ if (isSetBox==false || isSet == false)
{ this.stopDrag();
removeEventListener(MouseEvent.MOUSE_UP, clickcheck);}
finalx = this.x;
finaly = this.y;
if ((((finaly - initialy) ^ 2 + (finalx - initialx) ^ 2)^0.5) < 5)
{HandleDoubleClick(); } }
private function HandleDoubleClick():void
{if (this.x < 480 && this.y < 480)
{if (isSet == false)
{isSet = true;
this.stopDrag();
xx= int((this.x+16) / 32);
this.x = 32*xx;
yy= int((this.y+16) / 32);
this.y = (32 * yy);
for (var i:uint = 0; i < (exclusionx.length-1); i += 1)
{if (xx == exclusionx[i] && yy == exclusiony[i])
{notSet = true }}
if (generalx.length > 0)
{var notSet:Boolean;
   for (var q:uint = 0; q < (generalx.length - 1); q += 1)
{if (xx == generalx[q] && yy == generaly[q])
{notSet = true }
else {notSet=false}}}
if (notSet == false)
{handstatus[id] = "set";
addExclusion();
notSet = true; }
else {isSet = false;}}
else { handstatus[id] = "idle";
removeExclusion();}}
else if (this.x > 480 && this.y < 480 && this.x < 704)
{if (isSetBox == false)
{setonbox(); }
else {takeoffbox(); }} }
static private var killsetBox: Boolean;
static private var WM:Vector.<uint>;
static private var LM:Vector.<uint>;
static private var horzword:Vector.<Boolean>;
static private var vertword:Vector.<Boolean>;
static private var idtoreplace:uint;
private function rawscore(calcx:int, calcy:int):uint
{ var xincr:uint = 1;
var yincr:uint = 1;
var value:uint = 0;
while ((Number(boardarray[xx + (calcx * xincr)][yy + calcy * yincr])) != 0)
{ value += (boardarray[xx + (calcx * xincr)][yy + calcy * yincr]);
xincr += 1; yincr += 1; }
if (value == 0)
{ for (var i:uint = 0; exclusionx.length - 1;i+=1)
{ if (((exclusionx[i] == exclusionx[id]+calcx) && (exclusiony[i] == exclusiony[id] + calcy)))
{if (Math.abs(calcx) == 1)
{ horzword[id] = true;}
else {vertword[id] = true; } } } }
return value; }
static private var valuehor:Vector.<uint>;
static private var valuevert:Vector.<uint>;
static private var boardarray:Array=new Array[[]];
private function checkscore():void
{ switch(multiplier[exclusionx[id], exclusiony[id]])
{case "TW": WM[id] = 3; LM[id] = 1; break;
case "DW": WM[id] = 2; LM[id] = 1; break;
case "TL": LM[id] = 3; WM[id] = 1; break;
case "DL": LM[id] = 2; WM[id] = 1; break;
default: LM[id] = 1; WM[id] = 1;}
valuehor[id] = rawscore(1, 0) + rawscore( -1, 0);
valuevert[id] = rawscore(0, 1) + rawscore(0, -1); }
private function cleanup():void
{ if (mode == 2 || 3 || 4 || 5)
{ yplace = 0;
if (killsetBox=false)
{isSetBox = false;
handstatus[id] = "idle"; }
else
{if (isSetBox ==true)
{ this.visible = false;
this.kanafield.visible = false;
this.valuefield.visible = false;
handstatus[id] = "not";
killsetBox = false; } } }}
private var first:Boolean = true;
private function kanachange(e:Set):void
{ if (id==handstatus.indexOf(e.kanaex,0))
{kana = e.kanaex;
value = e.valueex;
kanafield.text = kana;
valuefield.text = String(value);
playerhandkana[id] = e.kanaex;
playerhandvalue[id] = e.valueex;}
else
{ kana = "";
value = 0;
handstatus[id] = "not";}}
private function setonbox():void
{addEventListener(Set.BOARD_SET_CHANGED, kanachange);
if (mode==3)
{isSetBox = true;
this.x = 480;
this.y = 448 - (yplace * 32);
handstatus[id] = "ret";}
else if (mode == 4)
{ if (yplace == 0)
{dispatchEvent(new Set(Set.BOX_SET_CHANGED, kana, 0));
isSetBox = true;
this.x = 480;
this.y = 448 - (yplace * 32);
handstatus[id] = "rem";} }
else if (mode == 5)
{ { isSetBox = true;
this.x = 480;
this.y = 448 - (yplace * 32);}
if (yplace == 0)
{dispatchEvent(new Set(Set.BOX_SET_CHANGED, "kanji", value)); }
else if (yplace > 0)
{dispatchEvent(new Set(Set.BOX_SET_CHANGED, "k+", value)); }
yplace += 1; }}
private function takeoffbox():void
{ removeEventListener(Set.BOARD_SET_CHANGED, kanachange);
isSetBox = false;
if (mode == 3)
{ handstatus[id] = "idle";
isSetBox=false}
else if (mode ==4)
{ if (yplace == 1)
{dispatchEvent(new Set(Set.BOX_SET_CHANGED, kana, 1));
isSetBox = false;
handstatus[id] = "idle" }
else if (mode == 5)
{ if (yplace == 1)
{dispatchEvent(new Set(Set.BOX_SET_CHANGED, "nokanji", value)); }
else if (yplace > 1)
{dispatchEvent(new Set(Set.BOX_SET_CHANGED, "k-", value)); }}
handstatus[id] = "idle";
yplace-= 1; }}
private function goodX(inX:Number):Number
{if (inX < 0)
{return 0;}
if (inX > (stage.stageWidth) )
{return (stage.stageWidth);
}return inX;}
private function goodY(inY:Number):Number {
if (inY < 0)
{return 0; }
if (inY > stage.stageHeight) {return stage.stageHeight;}
return inY; }
private function turn1():void
{if (playerRound > playernumber)
{playerRound = 1;
round += 1;
} } }}

Return to “Japanese Resources & Reviews”