2016-04-13 13 views
0

私はActionScript言語が新しく、動的テキストフィールドに改行を追加する方法が不思議でした。アクションスクリプト3引用符で囲まれた改行

テキストをテキストボックスに表示するように設定されていますが、質問の中には他のものよりも長いものがあります。これは、テキストの一部またはほとんどが画面から消えたことを意味します。

htmlの<br>タグと何か同じものを探しています。

ご不明な点がございましたら、お気軽にお問い合わせください。

var textField:TextField = new TextField(); 
textField.text = "Line\nBreak"; 
addChild(textField); 

enter image description here

: は、あなたのテキストに新しい行を挿入するためにエスケープシーケンス\nを使用することができます

import flash.events.MouseEvent; 

stop(); 

var nQNumber:Number = 0; 
var aQuestions:Array = new Array(); 
var aCorrectAnswers:Array = new Array("c", "ab", "c", "c", "d", "b", "a", "b", "a", "a", "abceg", "a", "b", "a", "a") 
var aUserAnswers:Array = new Array(); 
var cQAnswers:Array = new Array(); 

aQuestions[0] = "What does the evacuation siren sound like?"; 
aQuestions[1] = "What must you do if you hear the eacuation siren? (Multiple Answers)"; 
aQuestions[2] = "What must you do with cigarette lighters or matches while on the manifacturing site?"; 
aQuestions[3] = "Is it OK to carry a mobile phone on the manufacturing area of the site?"; 
aQuestions[4] = "What must you do if a chemical comes into contact with your eyes or skin?"; 
aQuestions[5] = "What is the maximum speed permitted on site?"; 
aQuestions[6] = "Who has the right of way at pedestrian crossings?"; 
aQuestions[7] = "Who must you report any injuries, incidents, near misses or hazards to?"; 
aQuestions[8] = "Where is the evacuation assembly area?"; 
aQuestions[9] = "Where can you access a Saftey Data Sheet? (Multiple Answers)"; 
aQuestions[10] = "What Personal Protective Equipment is required to be worn at all times on the manufacturing site? (Multiple Answers)"; 
aQuestions[11] = "Who is permitted to drive a forklift on site?"; 
aQuestions[12] = "When are you permitted to remove a tag?"; 
aQuestions[13] = "What is required before any maintenance or repairs are carried out on the plant? (Multiple answers)"; 
aQuestions[14] = "When should you wash your hands?"; 

cQAnswers[0] = ""; 
cQAnswers[1] = ""; 
cQAnswers[2] = ""; 
cQAnswers[3] = ""; 
cQAnswers[4] = ""; 
cQAnswers[5] = ""; 
cQAnswers[6] = ""; 
cQAnswers[7] = ""; 
cQAnswers[8] = ""; 
cQAnswers[9] = ""; 
cQAnswers[10] = ""; 
cQAnswers[11] = ""; 
cQAnswers[12] = ""; 
cQAnswers[13] = ""; 
cQAnswers[14] = ""; 

questions_txt.text = aQuestions [nQNumber]; 

submit_btn.addEventListener(MouseEvent.CLICK, quiz); 

function quiz(e:MouseEvent):void 
{ 
    aUserAnswers.push(answers_txt.text); 
    answers_txt.text = ""; 
    nQNumber++; 
    if(nQNumber < aQuestions.length) 
    { 
      questions_txt.text = aQuestions[nQNumber]; 
    } 
    else 
    { 
      nextFrame(); 
    } 
} 

The questions in the quotation marks in the array

答えて

0

(ここでは、フレームのコードです)エスケープシーケンスチャートを確認するhere

関連する問題