Reputation: 169
I am getting this runtime error-
TypeError: Error #2007: パラメーター text は null 以外でなければなりません。
Parameters text is must be non-null at flash.text::TextField/set text() at Tile/refresh()[C:\Users\Makiko\Desktop\Michael\Games\New Project\src\Tile.as:68] at Tile/init()[C:\Users\Makiko\Desktop\Michael\Games\New Project\src\Tile.as:58] at flash.display::DisplayObjectContainer/addChild() at Main/tileform()[C:\Users\Makiko\Desktop\Michael\Games\New Project\src\Main.as:115] at Main/deal()[C:\Users\Makiko\Desktop\Michael\Games\New Project\src\Main.as:106] at Main/createtile()[C:\Users\Makiko\Desktop\Michael\Games\New Project\src\Main.as:86] at Main/init()[C:\Users\Makiko\Desktop\Michael\Games\New Project\src\Main.as:54] at Main()[C:\Users\Makiko\Desktop\Michael\Games\New Project\src\Main.as:33]
I can't quite an exact equivalent question.
I think this code is the source of the issue but how to fix it?
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.events.*;
import excludespace;
import Math;
import flash.display.Bitmap;
import background;
import returncarrier;
import tilecarrier;
import Array;
import flash.text.*
public class Tile extends Sprite {
internal var mode :String = "practice";
internal var submode :String = "blank";
private var setX:int;
private var setY:int;
private var IDlocal:int;
private var kanalocal:String;
private var valuelocal:int;
private var kanafield:TextField;
private var valuefield:TextField;
internal var wordmultiplier:Array= new Array([[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,3,0,0,0,0,0,0,3,0,0,0,0,0,0,3],[0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0],[0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0],[0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0],[0,0,0,0,0,2,0,0,0,0,0,2,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,3],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0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ontName = "myFont",
mimeType = "application/x-font",
advancedAntiAliasing="true",
embedAsCFF = "false")]
internal var japanese:Class;*/
[Embed(source="/../lib/blank.png")]
internal var blank1:Class;
internal var checkstart:Boolean = false;
internal var start:Boolean = true;
private var blank2:Bitmap;
public function Tile(ID:int,kana:String,value:int):void {
IDlocal = ID;
kanalocal = kana;
valuelocal = value;
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event= null):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
blank2 = new blank1();
this.addChild(blank2);
addEventListener(excludespace.EVENT_START,refresh)
}
private function refresh(e:excludespace):void {
var myFormat:TextFormat = new TextFormat();
myFormat.size = 5;
myFormat.align = TextFormatAlign.CENTER;
//myFormat.font = myFont2.fontName;
var myText:TextField = new TextField();
myText.defaultTextFormat = myFormat;
myText.embedFonts = true;
myText.antiAliasType = AntiAliasType.ADVANCED;
myText.text = kanalocal;
addChild(myText);
myText.width = 15;
myText.height = 15;
myText.x = 0;
myText.y = 0;
}
}
}
In Main.as
Tileform shouldn't even run but it still gives an output. Now instead I get TypeError: Error #1034: 強制型変換に失敗しました。flashscreen_flash@44bbba1 を flash.display.Sprite に変換できません。 I failed to coercion . the flashscreen_flash @ 44bbba1 can not be converted to flash.display.Sprite. at flashscreen/init()[C:\Users\Makiko\Desktop\Michael\Games\New Project\src\flashscreen.as:23] at flash.display::DisplayObjectContainer/addChild() at Main/tileform()[C:\Users\Makiko\Desktop\Michael\Games\New Project\src\Main.as:153] at Main/deal()[C:\Users\Makiko\Desktop\Michael\Games\New Project\src\Main.as:122] at Main/createtile()[C:\Users\Makiko\Desktop\Michael\Games\New Project\src\Main.as:101] at Main/init()[C:\Users\Makiko\Desktop\Michael\Games\New Project\src\Main.as:69] at Main()[C:\Users\Makiko\Desktop\Michael\Games\New Project\src\Main.as:33]
private function deal():void
{
trace(hand_current.length);
for (var i:int = 0; i < (7-hand_current.length); i++)
{
var letterchoice:Number;
var randomnum:Number;
randomnum = (Math.random() * (1 + pool.length));
trace (randomnum);
letterchoice = Math.floor(randomnum);
trace (letterchoice);
hand_current.push(pool[letterchoice]);
pool.splice(letterchoice, 1);
for (var k:int = 0; k < 6; k++)
{
trace(k);
trace(baseset[hand_current[k]]);
trace(basevalue[hand_current[k]] );}
}
}
internal var tilearray:Array = new Array();
private function tileform():void
{
for (var i:int = 0; i < 6; i++)
{var atile:Sprite = new Tile(i,baseset[hand_current[i]],basevalue[hand_current[i]] );
atile.x = (i * 32);
atile.y = 480;
addChild(atile);
tilearray.push(atile);
}
screen = new flashscreen();
screen.x = 0;
screen.y = 0;
addChild(screen);
}
Upvotes: 0
Views: 124
Reputation: 2558
Error 2007 will occur when trying to set a property to a null value when it requires a non-null value. I believe kanalocal
is the null value.
myText.text = kanalocal;
Upvotes: 2