ダイナミックテキストボックスの異なる行をAS3のムービークリップに変換する方法は私のプロジェクトに関する質問がありますか?ダイナミックテキストボックスの別の行をAS3のムービークリップに変換する方法
実際、私はtest.txtという名前のテキストファイルを持っています。例えば:
それはで構成されています
今日は日曜です。今日は です。今日は です。今日は です。今日は です。今日は です。今日は です。
これらのすべてを配列に入れてから、文字列をtext_txtという動的テキストボックスに表示したいとします。
私のライブラリにはさまざまなオブジェクトがあります。最初の行に "sun"がある場合、最初のオブジェクト(obj01)はmcというムービークリップの内側にある特定の領域に表示されます。
質問はここにある:
拳:私は私の最初の行に異なるテキストを持っている場合。例えば、 "今日は太陽です;"どのように "太陽"がこの行にあるのを見つけるか???
2番目:ダイナミックテキストボックスの別の行をムービークリップに変換する方法。だから、ユーザーが "obj01"をクリックすると、動的テキストボックスの最初の行が大きくなります???
お時間をいただきありがとうございます。
import flash.events.MouseEvent;
var flag:int = 0;
//load the txt file
var myTextLoader:URLLoader = new URLLoader();
myTextLoader.addEventListener(Event.COMPLETE, onLoaded);
myTextLoader.load(new URLRequest("test.txt"));
//when the scene loads, all the info from txt file shown into the dynamic text;
function onLoaded(e:Event):void
{
//put all the info into array
var days:Array = e.target.data.split(/\n/);
var str:String;
//show them in the dynamic text
for (var i=0; i<days.length; i++)
{
str = days[i];
text_txt.appendText(str + "\n");
//if one text founded, do somethind and shoe an objectinthe output;
switch (str)
{
case "sun;\r" :
var obj01:Show = new Show();
mc.addChild(obj01);
obj01.x = -200;
obj01.y = -15;
break;
default :
trace("None of the above were met");
}
}
obj01.buttonMode = true;
//if the object clicked then something must be happend to the first line in the dynamic text box
obj01.addEventListener(MouseEvent.CLICK, firstLine);
function firstLine(e:MouseEvent):void
{
flag = 1;
switch (flag)
{
case 1 :
trace("Clicked!");
//the first line in the text box should get a different background and become more bigger
//Do I need to convert the first line to a movieclip? OR I need to do in another way?!
break;
default :
trace("None");
}
}
}
可能な重複[ムービークリップAS3のように動作し、文字列、および/または配列のフィールドを変換する方法](http://stackoverflow.com/questions/41087467/how-to-convert-string-and-or-array-fields-to-act-like-a-movie-clip-as3) – Brian